Can ask a class for its functions?
troy at gci.net
Wed Aug 14 22:10:30 EDT 2002
Or more list-comprehension-ly?
[x for x in clazz.__dict__.values() if callable(x)]
Peter Hansen wrote:
> Troy Melhase wrote:
>> This doesn't work because dir() returns a list of strings, none of which
>> are callable.
>> What you meant was:
>> filter(callable, [getattr(class_, attr) for attr in dir(class_)])
> Or more simply?
> filter(callable, clazz.__dict__.values())
mailto:troy at gci.net
More information about the Python-list