Michal Vitecek
fuf at mobil.cz
Fri Dec 13 09:10:35 EST 2002
Manera, Villiam wrote: [snip] > def sim_methods(self,obj): > from types import BuiltinMethodType > return filter(lambda s, t=obj: > type(getattr(t, s)) == BuiltinMethodType, dir(obj)) I just wanted to say that code using lambda functions is considerably slower than when it uses list comprehensions. thus the above is faster with: def sim_methods(self, obj): from types import BuiltinMethodType return [attribute for attribute in dir(obj) if (type(getattr(obj, attribute)) == BuiltinMethodType)] -- fuf (fuf at mobil.cz)
|