Re: Get the instance name from a list by Reflection

2007-10-22 Thread Gabriel Genellina
--- 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

Re: Get the instance name from a list by Reflection

2007-10-22 Thread Larry Bates
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 ()

Re: Get the instance name from a list by Reflection

2007-10-22 Thread jon vspython
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

Get the instance name from a list by Reflection

2007-10-20 Thread sccs cscs
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

Re: Get the instance name from a list by Reflection

2007-10-20 Thread Jean-Paul Calderone
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

Re: Get the instance name from a list by Reflection

2007-10-20 Thread Carsten Haese
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

Re: Get the instance name from a list by Reflection

2007-10-20 Thread Gabriel Genellina
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