How to obtain an instance's name at runtime?
Dinu C. Gherman
gherman at my-deja.com
Wed Jun 23 16:11:30 CEST 1999
This is a nasty question, perhaps, so I appologize in
advance if its stupidity level is far above the accepted
average in this newsgroup...
I would like to do the following:
>>> class C:
>>> c = C()
>>> C.__class__.__name__ # ok
>>> c.__name__ # not ok
Traceback (innermost last):
File "<interactive input>", line 0, in ?
Question: How to obtain an instance's name at runtime?
That is I'd like to see this happen (one was or the other):
I've checked the reference manual, but it's silent about
this topic or I'm too blind...
PS: Do not use my Deja email-address.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
More information about the Python-list