Thursday, 15 August 2013

Address of class method attribute in python

Address of class method attribute in python

Python 2.6.5 (r265:79063, Oct 1 2012, 22:07:21) [GCC 4.4.3]
>>> class myclass:
... def func(self):
... pass
>>> dd = myclass.func
>>> ee = myclass.func
>>> cc = myclass.func
>>> ff = myclass.func
>>> ss = myclass.func
>>> uu = myclass.func
>>> pp = myclass.func
>>>
>>>
>>> id(dd) ; id(cc) ; id(ee) ; id(ff) ; id(ss) ; id(uu) ; id(pp)
3074535252L
3074534772L
3074522444L
3074531732L
3074497588L
3073003604L
3073003724L
Why is the address of the unbound method different each time?
Shouldn't it be same ?

No comments:

Post a Comment