argument list

P

Phil Hornby

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...
 
J

John Roth

Phil Hornby said:
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...

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
 
J

John J. Lee

Phil Hornby said:
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...
[...]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,173
Messages
2,570,939
Members
47,484
Latest member
JackRichard

Latest Threads

Top