[issue29032] How does the __self__ attribute of method become a class rather a instance?

Serhiy Storchaka report at bugs.python.org
Wed Dec 21 04:23:16 EST 2016


Serhiy Storchaka added the comment:

The description looks correct to me. Note that it says about class methods.

>>> class A:
...     @classmethod
...     def f(cls): pass
... 
>>> a = A()
>>> A.f
<bound method A.f of <class '__main__.A'>>
>>> A.f.__self__
<class '__main__.A'>
>>> a.f
<bound method A.f of <class '__main__.A'>>
>>> a.f.__self__
<class '__main__.A'>

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29032>
_______________________________________


More information about the Python-bugs-list mailing list