How to decide if a object is instancemethod?
Ben Finney
ben+python at benfinney.id.au
Wed Mar 14 17:26:22 EDT 2012
Jon Clements <joncle at googlemail.com> writes:
> import inspect
> if inspect.ismethod(foo):
> # ...
>
> Will return True if foo is a bound method.
But under what other conditions will it return True? The name suggests
that *any* method – static method, class method, bound method, unbound
method – will also result in True.
The documentation says only “instance method”, though. Confusing :-(
--
\ “Airports are ugly. Some are very ugly. Some attain a degree of |
`\ ugliness that can only be the result of a special effort.” |
_o__) —Douglas Adams, _The Long Dark Tea-Time Of The Soul_ |
Ben Finney
More information about the Python-list
mailing list