How to obtain an instance's name at runtime?

Dinu C. Gherman Dinu.C..Gherman at p98.f112.n480.z2.fidonet.org
Thu Jul 1 07:27:45 EDT 1999


From: Dinu C. Gherman <gherman at my-deja.com>

In article <37769B92.47EBE99C at compaq.com>,
  Greg Ewing <greg.ewing at compaq.com> wrote:
>
> The best solution by far would be to give the
> object a name explicitly when you create it.
> Is this possible, or do you want to retrofit
> it onto existing code?

The latter is what I'm planning to do.

> It looks like you want it to be something like
> "the name of the first variable to be assigned
> a reference to the object". Does this apply to
> local variables as well as globals? Instance
> variables of another object? What if the object
> is never assigned to a variable? What if it
> is, but somewhere far removed from where it
> is created?

You're guessing very well... ;-) Actually, I will
postpone some issues until some advance is made at
other places of the code.

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)?

In any case thanks so far! I think the problem is not
a really fundamental one for the type of application
I'm having in mind, after all.

Bye,

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