Message299738
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>> |
|
Date |
User |
Action |
Args |
2017-08-04 11:41:14 | Johannes Lade | set | recipients:
+ Johannes Lade, rhettinger, pfalcon, gregory.p.smith, ezio.melotti, steven.daprano, docs@python, martin.panter |
2017-08-04 11:41:14 | Johannes Lade | set | messageid: <1501846874.37.0.831716987005.issue23702@psf.upfronthosting.co.za> |
2017-08-04 11:41:14 | Johannes Lade | link | issue23702 messages |
2017-08-04 11:41:13 | Johannes Lade | create | |
|