How to obtain the reference name

Paco barreraf at inicia.es
Mon Mar 10 07:42:30 EST 2003


Hy, somebody know how to obtain the name of an instance out of any methods
of the claas.
Example:

class A:
    def __init__(self):
        print 'hello'

j=A()


I need to obtain the name of the instance "j", something as is: "j.name" and
the value returned was "j"

Thanks.






More information about the Python-list mailing list