How to obtain an instance's name at runtime?

Lars Marius Garshol larsga at ifi.uio.no
Wed Jun 23 10:50:46 EDT 1999


* Dinu C. Gherman
|
| 
| Question: How to obtain an instance's name at runtime?
| That is I'd like to see this happen (one was or the other):
| 
| >>> c.__name__
| 'c'

How do you want this to behave if you go on from the situation you
have to type:

>>> d=c
>>> d.__name__
???
>>> c.__name__
???

--Lars M.




More information about the Python-list mailing list