metaclass : parse all class once before doing anything else ?

gene tani gene.tani at gmail.com
Sun Jul 30 11:02:20 EDT 2006


Paddy wrote:
> Laurent Rahuel wrote:
> >
> > Laurent.
>
> I, like Diez am unsure of why you would need what you have asked for,
> but maybe this will help.
>
> You can keep  track of all instances of a class by this kind of thing:
>
> >>> class C1(object):
> ... 	inst = []
> ... 	def __init__(self):
> ... 		self.inst.append(self)
> ...

or list all subclasses with

print LaurentsPutativeMetaClass.__subclasses__()

me 3 for: not clear what you're getting at




More information about the Python-list mailing list