Message374526
In Doc/howto/descriptor.rst:
# Internally, the bound method stores the underlying function,
# the bound instance, and the class of the bound instance.
>>> d.f.__func__
<function D.f at 0x1012e5ae8>
>>> d.f.__self__
<__main__.D object at 0x1012e1f98>
>>> d.f.__class__
<class 'method'>
The bound method (PyMethodObject) does not store "the class of the bound instance" - it only stores the "function" and "self".
d.f.__class__ is the class of the "method" type itself, not the class of d.f's instance (D from d = D())
I think this mention should be removed from the documentation? |
|
Date |
User |
Action |
Args |
2020-07-28 20:47:00 | Yonatan Goldschmidt | set | recipients:
+ Yonatan Goldschmidt, docs@python |
2020-07-28 20:47:00 | Yonatan Goldschmidt | set | messageid: <1595969220.64.0.879377287441.issue41427@roundup.psfhosted.org> |
2020-07-28 20:47:00 | Yonatan Goldschmidt | link | issue41427 messages |
2020-07-28 20:47:00 | Yonatan Goldschmidt | create | |
|