Keeping track of subclasses and instances?
_karlo_ at mosor.net
Thu Oct 11 03:19:07 CEST 2007
Larry Bates wrote:
> I'm not completely sure I understand the question but here goes.
> Instances of
> classes are classes can be stored in lists or dictionaries. In lists you
> reference them via their index (or iterate over them) and in dictionaries
> you can give them a name that is used as a key.
I wish if it were that simple :).
Here is a longer description - I have a function that given input creates a
custom class and returns it back. The user is free to subclass that (even
more, he should do that), and of course he will make instances of those
subclasses. Now, my question is how to keep track of subclasses and their
instances, without the need for user interaction (appending them to a list,
or adding to dictionary)?
Karlo Lozovina - Mosor
More information about the Python-list