Get the instance name from a list by Reflection

sccs cscs zorg724 at yahoo.fr
Sat Oct 20 15:10:34 EDT 2007


Hello,
I cannot find into documentation how to get the instance name. I found the attributes __dict__,__class__ ,__bases__ __name__ ,
but if i have the code:

class A :pass
a1 = A ()
a2 = A ()
aList = [a1,a2]
for elem in aList :
    print elem.__instance_name__ ???

I expect to have "a1" "a2" ...
But it does not work ...
help please
Zorgi

             
---------------------------------
 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071020/1ec2d8b5/attachment.html>


More information about the Python-list mailing list