Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21627

Re: How to decide if a object is instancemethod?

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: How to decide if a object is instancemethod?
References <8815977.3878.1331731738209.JavaMail.geo-discussion-forums@vbux23> <389400.5582.1331733455084.JavaMail.geo-discussion-forums@vbiz13>
Date 2012-03-15 08:26 +1100
Message-ID <87ty1qg9hd.fsf@benfinney.id.au> (permalink)
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


Jon Clements <joncle@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to decide if a object is instancemethod? Cosmia Luna <cosmius@gmail.com> - 2012-03-14 06:28 -0700
  Re: How to decide if a object is instancemethod? Jon Clements <joncle@googlemail.com> - 2012-03-14 06:57 -0700
    Re: How to decide if a object is instancemethod? Ben Finney <ben+python@benfinney.id.au> - 2012-03-15 08:26 +1100
      Re: How to decide if a object is instancemethod? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-14 23:30 +0000
    Re: How to decide if a object is instancemethod? Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-03-26 11:44 +0200

csiph-web