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 andrei.avk
Recipients andrei.avk, anthony-flury, docs@python, iritkatriel, mark.dickinson, r.david.murray, steven.daprano
Date 2021-06-07.18:54:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623092055.77.0.482169329392.issue27901@roundup.psfhosted.org>
In-reply-to
Content
The data model docs still have 2 references to unbound methods:

For callables, it may indicate that an instance of the given type (or a subclass) is expected or required as the first positional argument (for example, CPython sets this attribute for unbound methods that are implemented in C).
...
Incorrectly attempting to invoke an unbound method of a class in this way is sometimes referred to as ‘metaclass confusion’, and is avoided by bypassing the instance when looking up special methods:

So the concept of unbound methods is still valid, and in addition I would expect that majority of users think of a method defined in a class as a "method" rather than "function defined in class that will become a method" - perhaps because the former is much shorter ;-)

Therefore inspect.ismethod() returning False can easily cause confusion.

I think it might be worth adding this note to `ismethod` docs, something like:

"While the term 'unbound method' is commonly used for functions defined on class objects, from the point of view of `inspect` it is not a method because the object itself is just a plain function."

I can make a PR if this sounds reasonable?
History
Date User Action Args
2021-06-07 18:54:16andrei.avksetrecipients: + andrei.avk, mark.dickinson, steven.daprano, r.david.murray, docs@python, anthony-flury, iritkatriel
2021-06-07 18:54:15andrei.avksetmessageid: <1623092055.77.0.482169329392.issue27901@roundup.psfhosted.org>
2021-06-07 18:54:15andrei.avklinkissue27901 messages
2021-06-07 18:54:15andrei.avkcreate