astropy 5.0

ParametersBackRef
isinstancemethod(cls, obj)

This requires both the class the object is a member of as well as the object itself in order to make this determination.

Parameters

cls : `type`

The class on which this method was defined.

obj : `object`

A member of the provided class (the membership is not checked directly, but this function will always return :None:None:`False` if the given object is not a member of the given class).

Returns :None:None:`True` if the given object is an instance method of the class it is defined on (as opposed to a :None:None:`staticmethod` or a :None:None:`classmethod`).

Examples

This example is valid syntax, but we were not able to check execution
>>> class MetaClass(type):
...  def a_classmethod(cls): pass ...
This example is valid syntax, but we were not able to check execution
>>> class MyClass(metaclass=MetaClass):
...  def an_instancemethod(self): pass ... ... @classmethod ... def another_classmethod(cls): pass ... ... @staticmethod ... def a_staticmethod(): pass ...
This example is valid syntax, but we were not able to check execution
>>> isinstancemethod(MyClass, MyClass.a_classmethod)
False
This example is valid syntax, but we were not able to check execution
>>> isinstancemethod(MyClass, MyClass.another_classmethod)
False
This example is valid syntax, but we were not able to check execution
>>> isinstancemethod(MyClass, MyClass.a_staticmethod)
False
This example is valid syntax, but we were not able to check execution
>>> isinstancemethod(MyClass, MyClass.an_instancemethod)
True
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

astropy.utils.introspection.isinstancemethod

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /astropy/utils/introspection.py#393
type: <class 'function'>
Commit: