[issue16851] ismethod and isfunction methods error

2013-01-08 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16851] ismethod and isfunction methods error

2013-01-08 Thread Federico Reghenzani

Changes by Federico Reghenzani :


--
keywords: +patch
Added file: http://bugs.python.org/file28630/inspect.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16851] ismethod and isfunction methods error

2013-01-03 Thread Ezio Melotti

Ezio Melotti added the comment:

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

>>> add(3, 4)
7
>>> def add(a, b): return a+b
... 
>>> add

>>> 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
>

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().

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
keywords: +easy
nosy: +docs@python, ezio.melotti
stage:  -> needs patch
type: behavior -> enhancement
versions: +Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16851] ismethod and isfunction methods error

2013-01-03 Thread Wojciech Danilo

New submission from Wojciech Danilo:

Hi! I think this behaviour is bug. Lets concider the following code:

import inspect
class X(object):
def a(self):pass
def b(self):pass
def c(self):pass

print(inspect.getmembers(X, predicate=inspect.ismethod))
print(inspect.getmembers(X, predicate=inspect.isfunction))

In python 2.7, the results are:
[('a', ), ('b', ), ('c', )]
[]

and in Python 3.2:
[]
[('a', ), ('b', ), ('c', 
)]

I think, the results from python 2.7 are correct.

--
components: Library (Lib)
messages: 178964
nosy: wdanilo
priority: normal
severity: normal
status: open
title: ismethod and isfunction methods error
type: behavior
versions: Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com