This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Yonatan Goldschmidt
Recipients Yonatan Goldschmidt, docs@python
Date 2020-07-28.20:47:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595969220.64.0.879377287441.issue41427@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-07-28 20:47:00Yonatan Goldschmidtsetrecipients: + Yonatan Goldschmidt, docs@python
2020-07-28 20:47:00Yonatan Goldschmidtsetmessageid: <1595969220.64.0.879377287441.issue41427@roundup.psfhosted.org>
2020-07-28 20:47:00Yonatan Goldschmidtlinkissue41427 messages
2020-07-28 20:47:00Yonatan Goldschmidtcreate