How to obtain an instance's name at runtime?

Tim Peters tim_one at email.msn.com
Thu Jul 1 11:53:56 EDT 1999


[Dinu C. Gherman]
> ...
> Just that much: an object, that has not been assigned
> a name to, cannot exist (having a reference count of
> zero), can it (at least for user-defined objects)?

There must be a way to "get to" it, but access paths needn't be names; e.g.,

week = [Day("Sunday"), Day("Monday"), ...]

The object constructed by Day("Monday") was never given a name, and is
accessible only via the access path week[1] (or equivalent from the end of
the list).

anonymously y'rs  - tim







More information about the Python-list mailing list