Andrei Kulakov <andrei....@gmail.com> added the comment:

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?

----------
nosy: +andrei.avk

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27901>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to