PyDocs

Nav

Python Runtime Services

ismethoddescriptor

inspect

function (source)
  • ismethoddescriptor(object)
Return true if the object is a method descriptor.

But not if ismethod(), isclass() or isfunction() is true.

An object passing this test (for example, int.__add__) has a __get__
attribute, but not a __set__ attribute or a __delete__ attribute.
Beyond that, the set of attributes varies; __name__ is usually
sensible, and __doc__ often is.

Methods implemented via descriptors that also pass one of the other
tests (ismethod(), isclass(), isfunction()) make this function return
false, simply because those other tests promise more -- you can, for
example, count on having the __func__ attribute when an object passes
ismethod().
Changed in 3.13
  • 3.13: This function no longer incorrectly reports objects with __get__() and __delete__(), but not __set__(), as being method descriptors (such objects are data descriptors, not method descriptors).
0 Examples
No examples for inspect/ismethoddescriptor.
See Also
No see-alsos for inspect/ismethoddescriptor
0 Notes
No notes for ismethoddescriptor