[docs] [issue23702] docs.python.org/3/howto/descriptor.html still refers to "unbound methods"
Johannes Lade
report at bugs.python.org
Fri Aug 4 07:41:14 EDT 2017
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 <report at bugs.python.org>
<http://bugs.python.org/issue23702>
_______________________________________
More information about the docs
mailing list