, id(A().a) :
A()
A().a # creates a function f bound to a
A.a.__get__(A(), A) # same as above
>>> A.a.__get__(A(), A)
<bound method A.a of <__main__.A object at 0x02D85550>>
>>> A().a
<bound method A.a of <__main__.A object at 0x02D29410>>
, __self__
>>> a = A()
>>> assert a.a.__self__ is a
__self__ self A.a
EDIT: :
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> class A:
def a(self):
pass
>>> id(A().a)
43476312
>>> id(A().a)
49018760
id abab
Python 3.2.2 (default, Sep 4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> class A:
def a(self):
pas
s
>>> id(A().a)
50195512
>>> id(A().a)
50195832
>>> id(A().a)
50195512
>>> id(A().a)
50195832
EDIT: Linux
id(A().a)
, , .
, , , - .
, .