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?

From Cosmia Luna <cosmius@gmail.com>
Newsgroups comp.lang.python
Subject How to decide if a object is instancemethod?
Date 2012-03-14 06:28 -0700
Organization http://groups.google.com
Message-ID <8815977.3878.1331731738209.JavaMail.geo-discussion-forums@vbux23> (permalink)

Show all headers | 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