argument list

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Hornby

    argument list

    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

    #2
    Re: argument list


    "Phil Hornby" <phil.hornby@ac cutest.co.uk> wrote in message
    news:mailman.14 6.1072646016.68 4.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]


    Comment

    • John J. Lee

      #3
      Re: argument list

      "Phil Hornby" <phil.hornby@ac cutest.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

      Comment

      Working...