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


Groups > comp.lang.python > #21597

How to decide if a object is instancemethod?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Cosmia Luna <cosmius@gmail.com>
Newsgroups comp.lang.python
Subject How to decide if a object is instancemethod?
Date Wed, 14 Mar 2012 06:28:58 -0700 (PDT)
Organization http://groups.google.com
Lines 13
Message-ID <8815977.3878.1331731738209.JavaMail.geo-discussion-forums@vbux23> (permalink)
NNTP-Posting-Host 74.207.251.187
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1331731844 3833 127.0.0.1 (14 Mar 2012 13:30:44 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Wed, 14 Mar 2012 13:30:44 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=74.207.251.187; posting-account=oNuSIgoAAAAZId4Ea0hBMGd7JwNhEw7j
User-Agent G2/1.0
Xref csiph.com comp.lang.python:21597

Show key headers only | View raw


class Foo(object):
    def bar(self):
        return 'Something'

func = Foo().bar

if type(func) == <type 'instancemethod'>: # This should be always true
    pass # do something here

What should type at <type 'instancemethod'>?

Thanks
Cosmia

Back to comp.lang.python | Previous | NextNext 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