You are not logged in.

#1 2005-07-15 18:51:58

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

getting a python function's signature

ok... let's pretend I have:

class foibles:
   def foo(self):
      print 'foo'
   def bar(self,a,b):
      print 'bar ' + a + ' '+ b
   def baz(self,a,b,c,d,e,f,g,h,i,j):
      print 'BAM!'

Now, dir(foibles) works fine to get the functions of the class... but is there anyway to get the params of each function? I'm looking for something like:

>>> foibles.baz.__signature__
baz(self,a,b,c,d,e,f,g,h,i,j)

Offline

#2 2005-07-16 02:00:33

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: getting a python function's signature

quick look through the library reference find me this:

http://docs.python.org/lib/module-inspect.html
http://docs.python.org/lib/inspect-clas … tions.html

hope it helps.

Offline

Board footer

Powered by FluxBB