Get the instance name from a list by Reflection

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Oct 20 18:44:28 EDT 2007


En Sat, 20 Oct 2007 16:10:34 -0300, sccs cscs <zorg724 at yahoo.fr> escribi�:

> 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:

In general, you can't. There is no such thing as "the instance name".
See  
http://www.python.org/doc/faq/programming/#how-can-my-code-discover-the-name-of-an-object

-- 
Gabriel Genellina




More information about the Python-list mailing list