Karlo Lozovina schrieb:
> Hi,
> 
> what's the best way to keep track of user-made subclasses, and instances of
> those subclasses? I just need a pointer in a right direction... thanks.
> 

New style classes have a __subclasses__ class method that shows the direct 
subclasses:

Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> object.__subclasses__()
[<type 'type'>, <type 'weakref'>, <type 'int'>, <type 'basestring'>, <type 
'list'>, <type 'NoneType'>, ...
>>>

No builtin mechanism for instances exists, afaik.

Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to