module functions list
Peter Otten
__peter__ at web.de
Wed Aug 25 09:01:11 EDT 2004
Diez B. Roggisch wrote:
> Hi,
>
>> You could use a list comprehension coupled with a filter:
>>
>> functionList = [function for function in dir(objectName) \
>> if callable(getattr(objectName,function))]
Note that callable() will not filter out classes. If you want to exclude
classes from your list, have a look at inspect.isfunction() or
inspect.isroutine().
> That works if objectName is my module - but how do I get a reference to
> the current module _inside_ my module? Thats the hart part (at least for
> me ...)
sys.modules[__name__]
Peter
More information about the Python-list
mailing list