Connecting Tech Pros Worldwide Help | Site Map

argument list

Phil Hornby
Guest
 
Posts: n/a
#1: Jul 18 '05
Dear Python List,

I am working on a solution embedding Python in an app that will looks for
specific string combination within the function names to determine if a
handler for an event exists; I have been able to extract the function names
and find all of the 'fields' of interest. What I am concerned about,
however, is that they could have the wrong argument profile, as specific
handlers will have specific function arguments - can I find out what
arguments a specific functions takes from the C-API? As I don't seem to be
able to find anything...but I could be just being blind...

Thanks...

--
Phil Hornby


John Roth
Guest
 
Posts: n/a
#2: Jul 18 '05

re: argument list



"Phil Hornby" <phil.hornby@accutest.co.uk> wrote in message
news:mailman.146.1072646016.684.python-list@python.org...[color=blue]
> Dear Python List,
>
> I am working on a solution embedding Python in an app that will looks for
> specific string combination within the function names to determine if a
> handler for an event exists; I have been able to extract the function[/color]
names[color=blue]
> and find all of the 'fields' of interest. What I am concerned about,
> however, is that they could have the wrong argument profile, as specific
> handlers will have specific function arguments - can I find out what
> arguments a specific functions takes from the C-API? As I don't seem to be
> able to find anything...but I could be just being blind...[/color]

Look at the inspect module. That's the best you can do;
exact type information simply isn't availible.

The times I've actually needed this I've simply built a metadata
dictionary into the affected classes using a fixed name. So far,
I've only needed it twice, so I don't have a real good feel for the
"best" structure for such a facility.

John Roth[color=blue]
>
> Thanks...
>
> --
> Phil Hornby
>
>[/color]


John J. Lee
Guest
 
Posts: n/a
#3: Jul 18 '05

re: argument list


"Phil Hornby" <phil.hornby@accutest.co.uk> writes:[color=blue]
> I am working on a solution embedding Python in an app that will looks for
> specific string combination within the function names to determine if a
> handler for an event exists; I have been able to extract the function names
> and find all of the 'fields' of interest. What I am concerned about,
> however, is that they could have the wrong argument profile, as specific
> handlers will have specific function arguments - can I find out what
> arguments a specific functions takes from the C-API? As I don't seem to be
> able to find anything...but I could be just being blind...[/color]
[...]

First, maybe what you really want is just the equivalent of
func(*args, **kwds)? (don't remember off the top of my head how to do
that)

Or maybe what you're missing is that you can just use different method
naming conventions for different kinds of handler?


John
Closed Thread