gettin a list of functions?

Wojtek Walczak gminick at hacker.pl
Mon Dec 9 11:06:32 EST 2002


Dnia 9 Dec 2002 07:35:22 -0800, Hunter Peress napisał(a):
> either this will involve parsing the output of dir() 

a = dir(SCOPE)
map(lambda x: x.__name__, filter(callable, [getattr(SCOPE, i) for i in a]))

for example:

>>> import sys
>>> a = dir(sys)
>>> map(lambda x: x.__name__, filter(callable, [getattr(sys, i) for i in a]))
['displayhook', 'excepthook', '_getframe', 'displayhook', 'exc_info', 'excepthook', 'exit', 'getdefaultencoding', 'getdlopenflags', 'getrecursionlimit', 'getrefcount', 'NameError', 'setcheckinterval', 'setdlopenflags', 'setprofile', 'setrecursionlimit', 'settrace']
>>> _

HTH :)

-- 
[ ] gminick (at) underground.org.pl  http://gminick.linuxsecurity.pl/ [ ]
[ "Po prostu lubie poranna samotnosc, bo wtedy kawa smakuje najlepiej." ]



More information about the Python-list mailing list