Author ezio.melotti
Recipients docs@python, ezio.melotti, wdanilo
Date 2013-01-03.16:56:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357232183.0.0.614786408485.issue16851@psf.upfronthosting.co.za>
In-reply-to
Content
I think that's expected and by design.  In Python 3 there are no unbound methods, but simply functions:
>>> class X:
...   def add(a, b): return a+b
... 
>>> add = X.add
>>> add
<function add at 0xb740d26c>
>>> add(3, 4)
7
>>> def add(a, b): return a+b
... 
>>> add
<function add at 0xb740d22c>
>>> add(3, 4)
7

As you can see there's no real difference between the two "add".

It's different though with bound methods (obtained from an instance rather than a class):

>>> add = X().add
>>> add
<bound method X.add of <__main__.X object at 0xb740e0ec>>

The documentation is also clear that ismethod() "Return true if the object is a bound method written in Python.".  Maybe an additional note can be added to state that "unbound methods" are not included, and that are instead recognized by isfunction().
History
Date User Action Args
2013-01-03 16:56:23ezio.melottisetrecipients: + ezio.melotti, docs@python, wdanilo
2013-01-03 16:56:23ezio.melottisetmessageid: <1357232183.0.0.614786408485.issue16851@psf.upfronthosting.co.za>
2013-01-03 16:56:22ezio.melottilinkissue16851 messages
2013-01-03 16:56:22ezio.melotticreate