infering the number of args a function takes at runtime

Chris Rebert clp at rebertia.com
Mon Dec 8 05:45:19 CET 2008


On Sun, Dec 7, 2008 at 8:39 PM, sniffer <adi at lspl.net> wrote:
> hi all,
> i am a python newbie, in a project currently doing i need to find out
> the number of arguments that a function takes at runtime.? Is this
> possible ,if so how do i do this,i ve looked through the python
> documentation but couldnt find anything.any help will be great

You want inspect.getargspec() or one of its friends in the `inspect`
module. See http://docs.python.org/library/inspect.html#inspect.getargspec

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com
I really should get back to studying now

>
>
> TIA
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list