Johannes Lade added the comment:

This is still a problem. Can please somebody fix this? There are already enough 
confusing discussion full of wrong information about this topic, so it would be 
nice if the official documentation would get it right. Also there's multiple 
Issues for this. Can they be combined into one?
Just one example I found: on 
https://docs.python.org/3.5/howto/descriptor.html#functions-and-methods

Documentation:
>>> class D(object):
...     def f(self, x):
...         return x
...
>>> d = D()
>>> D.__dict__['f']  # Stored internally as a function
<function f at 0x00C45070>
>>> D.f              # Get from a class becomes an unbound method
<unbound method D.f>
>>> d.f              # Get from an instance becomes a bound method
<bound method D.f of <__main__.D object at 0x00B18C90>>

ipython3.5.3
In [1]: class D(object):
   ...: ...     def f(self, x):
   ...: ...         return x
   ...: ...

In [2]: d = D()

In [3]: D.__dict__['f']  # Stored internally as a function
Out[3]: <function __main__.D.f>

In [4]: D.f              # Get from a class becomes an unbound method
Out[4]: <function __main__.D.f>

In [5]: d.f              # Get from an instance becomes a bound method
Out[5]: <bound method D.f of <__main__.D object at 0x7f4e2e278c18>>

----------
nosy: +Johannes Lade

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23702>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to