[Tutor] listing classes
Laureano Arcanio
listas.condhor at gmail.com
Wed May 21 22:55:33 CEST 2008
Finally, i decide to make this:
from metatag import MetaTag
from htmltools import TagHTML
class Structure(object):
class A(TagHTML):
pass
class B(TagHTML):
pass
def get(self):
__all__ = dir(self)
classes = filter(lambda k: type(getattr(self, k)) == type(TagHTML) ,
__all__)
methods = filter(lambda k: str(type(getattr(self, k))) == "<type
'instancemethod'>" , __all__)
return classes, methods
So i can Lis Methods and Classes, and then use setattr or whatever needed.
There is a think left, i can't jus compare this:
if type(somethingA) == type(somthingB):
I transform type() to a string and then compare them.. (like in the code
below)
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080521/61f953ac/attachment-0001.htm>
More information about the Tutor
mailing list