--- sccs cscs [EMAIL PROTECTED] escribió:
Thank you, but i believe that i could get all
variables names that reference an instance: i need
it for a special debug tool... It seems that
knowledge exists somewhere into the Python
interpreter...
Please read first the FAQ item posted
Jean-Paul Calderone wrote:
On Sat, 20 Oct 2007 21:10:34 +0200 (CEST), sccs cscs [EMAIL PROTECTED]
wrote:
Hello,
I cannot find into documentation how to get the instance name. I found
the attributes __dict__,__class__ ,__bases__ __name__ ,
but if i have the code:
class A :pass
a1 = A ()
May be, you could check against globals() dictionary looking for matching
id()'s:
def find_name(identifier):
for k,v in globals().items():
if id(v) == id(identifier):
return k
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I cannot find into documentation how to get the instance name. I found the
attributes __dict__,__class__ ,__bases__ __name__ ,
but if i have the code:
class A :pass
a1 = A ()
a2 = A ()
aList = [a1,a2]
for elem in aList :
print elem.__instance_name__ ???
I expect to have a1 a2 ...
But
On Sat, 20 Oct 2007 21:10:34 +0200 (CEST), sccs cscs [EMAIL PROTECTED] wrote:
Hello,
I cannot find into documentation how to get the instance name. I found the
attributes __dict__,__class__ ,__bases__ __name__ ,
but if i have the code:
class A :pass
a1 = A ()
a2 = A ()
aList = [a1,a2]
for elem
On Sat, 2007-10-20 at 21:10 +0200, sccs cscs wrote:
Hello,
I cannot find into documentation how to get the instance name.
That's because this is, in general, impossible. An object can have any
number of names, even zero names, and an object doesn't know which names
it has.
Why do you think you
En Sat, 20 Oct 2007 16:10:34 -0300, sccs cscs [EMAIL PROTECTED] escribi�:
I cannot find into documentation how to get the instance name. I found
the attributes __dict__,__class__ ,__bases__ __name__ ,
but if i have the code:
In general, you can't. There is no such thing as the instance