Typo error in Python 3.5 documentation
Hello, Quick email to notice about a typo error on the following documentation page : https://docs.python.org/3.5/tutorial/classes.html#method-objects On the last line of the example, a dot is missing between x and f : 9.3.4. Method Objects <https://docs.python.org/3.5/tutorial/classes.html#method-objects> Usually, a method is called right after it is bound: x.f() In the MyClass example, this will return the string 'hello world'. However, it is not necessary to call a method right away: x.f is a method object, and can be stored away and called at a later time. For example: xf = x.fwhile True: print(xf()) Thanks for the efforts on the documentations,
Hi Matthieu, On Wed, Nov 11, 2015 at 11:58 PM, Matthieu de La Roche Saint-André <matthieudelaro@gmail.com> wrote:
Hello,
Quick email to notice about a typo error on the following documentation page : https://docs.python.org/3.5/tutorial/classes.html#method-objects
On the last line of the example, a dot is missing between x and f
Actually, it's not; that's the point of the example :). Note that the first line of the last example is "xf = x.f", which assigns the method object to the name "xf", which is then used (called) in the last line. Try it out using the MyClass class from further up the page. The page could perhaps use an update to make that more obvious (and the example less obnoxious to run), such as: method = x.f for each in range(5): print(method()) ...but what's there now is not wrong. Thanks for the report, though! Regards, -- Zach
Oh right, sorry for useless notification. Thanks a lot for answering though, I was reading fast to adapt my knowledge from other languages and indeed completely missed the point. On 12 November 2015 at 15:22, Zachary Ware <zachary.ware+pydocs@gmail.com> wrote:
Hi Matthieu,
Hello,
Quick email to notice about a typo error on the following documentation
On Wed, Nov 11, 2015 at 11:58 PM, Matthieu de La Roche Saint-André <matthieudelaro@gmail.com> wrote: page
: https://docs.python.org/3.5/tutorial/classes.html#method-objects
On the last line of the example, a dot is missing between x and f
Actually, it's not; that's the point of the example :). Note that the first line of the last example is "xf = x.f", which assigns the method object to the name "xf", which is then used (called) in the last line. Try it out using the MyClass class from further up the page.
The page could perhaps use an update to make that more obvious (and the example less obnoxious to run), such as:
method = x.f for each in range(5): print(method())
...but what's there now is not wrong.
Thanks for the report, though!
Regards, -- Zach
participants (2)
-
Matthieu de La Roche Saint-André -
Zachary Ware