How to obtain an instance's name at runtime?

Dinu C. Gherman gherman at my-deja.com
Wed Jun 23 13:39:14 EDT 1999


In article <7kqrc5$9fs at cs.vu.nl>,
  Frank Niessink <frankn=news at cs.vu.nl> wrote:
> Dinu C. Gherman <gherman at my-deja.com> wrote:
>
> > Question: How to obtain an instance's name at runtime?
>
> That instance doesn't have a name. Take for example:
>
> >>> a = b = c = C()
>
> That creates one instance of C, with three references to it.
> Now what is the `real' name of the instance?

Very true, very true - I new there was something good about
Python, here: object references, making something else rather
impossible! Still, I wish it was possible to access the "name
administrator" somewhere deep inside the Python interpreter to
have that. I'll give more reasons for that only in a couple
of days, I hope... Sorry for not being more precize, now!

Dinu



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list