New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs.python.org/3/howto/descriptor.html still refers to "unbound methods" #67890
Comments
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). |
Current patch for bpo-25435 addresses the code example. Changes to the text are also needed though. |
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 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 class MyClass:
def spam(self, arg): ... a method, even though it is also/really a function. |
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). |
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? 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 [2]: d = D() In [3]: D.__dict__['f'] # Stored internally as a function In [4]: D.f # Get from a class becomes an unbound method In [5]: d.f # Get from an instance becomes a bound method |
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. |
We have a sprint in early September and I'll fix it then. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: