finding name of instances created
andre.roberge at gmail.com
Fri Jan 21 19:13:19 EST 2005
Short version of what I am looking for:
Given a class "public_class" which is instantiated a few times e.g.
a = public_class()
b = public_class()
c = public_class()
I would like to find out the name of the instances so that I could
create a list of them e.g.
['a', 'b', 'c']
I've read the Python Cookbook, Python in a Nutshell, Programming
Python, Learning Python, ... googled (probably missed something
obvious), all to no avail.
If I can do the above, I believe I could do the following thing which
is what I am really after eventually.
Given the statement
>> a = public_class()
I would like to generate
>> my_dict['a'] = private_class()
so that one could write
and that, behind the scene, I could translate that as
as well as do things like
>> for name in my_dict:
Any help, pointers, sketches or outline of solution would be greatly
More information about the Python-list