[issue23702] docs.python.org/3/howto/descriptor.html still refers to "unbound methods"
New submission from Paul Sokolovsky: Under https://docs.python.org/3/howto/descriptor.html#functions-and-methods , there're several references to unbound methods (including in expected output from the interpreter). As known, unbound methods are gone in Python3, so seeing those are confusing. (I didn't sharply know that unbound methods are gone from Py3, so was pretty confused by the examples there, comparing them with actual output of Cpython 3.4). ---------- assignee: docs@python components: Documentation messages: 238468 nosy: docs@python, pfalcon priority: normal severity: normal status: open title: docs.python.org/3/howto/descriptor.html still refers to "unbound methods" versions: Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
Changes by Ezio Melotti <ezio.melotti@gmail.com>: ---------- nosy: +ezio.melotti stage: -> needs patch type: -> behavior _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
Martin Panter added the comment: Current patch for Issue 25435 addresses the code example. Changes to the text are also needed though. ---------- dependencies: +Wrong function calls and referring to not removed concepts in descriptor HowTo (documentation) nosy: +martin.panter _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
Changes by Ezio Melotti <ezio.melotti@gmail.com>: ---------- versions: +Python 3.5, Python 3.6 -Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
Changes by Gregory P. Smith <greg@krypto.org>: ---------- nosy: +gregory.p.smith priority: normal -> high _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue23702> _______________________________________
Steven D'Aprano added the comment: Be careful with the documentation patch. Although unbound method as an object type is gone, unbound method as a concept is not. Conceptually, something like ``MyClass.spam`` is an unbound method: it is a method of the MyClass type, but bound to no instance. In Python 2 that concept was implemented by MethodType. In Python 3, the concept is implemented by FunctionType. While it is certainly true from one perspective that unbound methods are nothing but functions, it is nevertheless also sometimes useful to distinguish from "functions defined in a class" (methods) and "other functions". I think that nearly all Python programmers would be happy to call ``spam`` below: class MyClass: def spam(self, arg): ... a method, even though it is also/really a function. ---------- nosy: +steven.daprano _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
Raymond Hettinger added the comment: I'll fix that up. I've already been working on revising the document. There are a number of updates needed (user-friendly intro, properties revised to show the setting methods, __set_name__, etc). ---------- assignee: docs@python -> rhettinger nosy: +rhettinger priority: high -> normal _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
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@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
Johannes Lade added the comment: And sorry for my lousy manners. Of course I appreciate all the hard work you do! It's just frustrating when you get confused by doc. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
Raymond Hettinger added the comment: We have a sprint in early September and I'll fix it then. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue23702> _______________________________________
Changes by Raymond Hettinger <raymond.hettinger@gmail.com>: ---------- keywords: +patch pull_requests: +3725 stage: needs patch -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue23702> _______________________________________
Raymond Hettinger added the comment: New changeset 0d4497b9cae7942b7f731a6f99a73985c3fb4630 by Raymond Hettinger in branch 'master': bpo-23702: Update Descriptor-HOWTO to reflect the removal of unbound methods (#3739) https://github.com/python/cpython/commit/0d4497b9cae7942b7f731a6f99a73985c3f... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue23702> _______________________________________
Changes by Roundup Robot <devnull@psf.upfronthosting.co.za>: ---------- pull_requests: +3729 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue23702> _______________________________________
Raymond Hettinger added the comment: New changeset 73c915a5cd1cdd8775cf47b77fef7ca8fd42ad96 by Raymond Hettinger (Miss Islington (bot)) in branch '3.6': [3.6] bpo-23702: Update Descriptor-HOWTO to reflect the removal of unbound methods (GH-3739) (#3742) https://github.com/python/cpython/commit/73c915a5cd1cdd8775cf47b77fef7ca8fd4... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue23702> _______________________________________
Changes by Raymond Hettinger <raymond.hettinger@gmail.com>: ---------- dependencies: -Wrong function calls and referring to not removed concepts in descriptor HowTo (documentation) _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue23702> _______________________________________
Changes by Raymond Hettinger <raymond.hettinger@gmail.com>: ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue23702> _______________________________________
participants (8)
-
Ezio Melotti
-
Gregory P. Smith
-
Johannes Lade
-
Martin Panter
-
Paul Sokolovsky
-
Raymond Hettinger
-
Roundup Robot
-
Steven D'Aprano