This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Possibly incorrect description about method objects
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Jim Fasarakis-Hilliard, docs@python, python-dev, r.david.murray, woo yoo
Priority: normal Keywords: patch

Created on 2016-12-18 15:50 by woo yoo, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
method_obj35.patch Jim Fasarakis-Hilliard, 2016-12-18 17:10 review
method_obj35_2.patch Jim Fasarakis-Hilliard, 2016-12-18 19:49 review
Messages (10)
msg283556 - (view) Author: woo yoo (woo yoo) Date: 2016-12-18 15:50
"In general, calling a method with a list of n arguments is equivalent to calling the corresponding function with an argument list that is created by inserting the method’s object before the first argument."

Is  above description right?
The link is https://docs.python.org/3.5/tutorial/classes.html#method-objects
msg283557 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2016-12-18 16:10
Seems right to me, this is also stated clearly in the reference manual:

> When an instance method object is called, the underlying function (__func__) is called, inserting the class instance (__self__) in front of the argument list. For instance, when C is a class which contains a definition for a function f(), and x is an instance of C, calling x.f(1) is equivalent to calling C.f(x, 1).

What doesn't look right to you?
msg283558 - (view) Author: woo yoo (woo yoo) Date: 2016-12-18 16:15
Maybe the last "method's" should be changed into "class instance"
msg283559 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2016-12-18 16:22
I see. I'd agree that `instance object` is probably better here. Let's see what others think.
msg283560 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-12-18 16:25
Given the (clearer) explanation in the final paragraph of that section, I think the bare 'object' in the first couple paragraphs should be replaced by 'instance object'.  There are multiple objects involved, and that will disambiguate which one is being referred to for insertion as the first argument, and make the language of the section self-consistent.
msg283562 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2016-12-18 17:10
I've added a little patch that takes care of this. I didn't add "method's instance object" in the second substitution because it seems evident by the previous sentences.
msg283565 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-12-18 19:31
I think it is better to say "the method's instance object", because in the final paragraph we discuss the fact that each method object has an associated instance object.  The instance object isn't magically acquired from elsewhere and added, it is added because it has been bound into the method object.
msg283566 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2016-12-18 19:49
Agreed, attached amended patch
msg283567 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-12-18 20:03
New changeset 6f89f5eb4422 by R David Murray in branch '3.5':
#29005: clarify terminology in tutorial 'method' discussion.
https://hg.python.org/cpython/rev/6f89f5eb4422

New changeset 7314e08dc907 by R David Murray in branch '3.6':
Merge: #29005: clarify terminology in tutorial 'method' discussion.
https://hg.python.org/cpython/rev/7314e08dc907

New changeset 3cc193be79ab by R David Murray in branch 'default':
Merge: #29005: clarify terminology in tutorial 'method' discussion.
https://hg.python.org/cpython/rev/3cc193be79ab
msg283568 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-12-18 20:04
Thanks, woo and Jim.
History
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 73191
2016-12-18 20:04:09r.david.murraysetstatus: open -> closed
type: behavior
messages: + msg283568

resolution: fixed
stage: resolved
2016-12-18 20:03:05python-devsetnosy: + python-dev
messages: + msg283567
2016-12-18 19:49:26Jim Fasarakis-Hilliardsetfiles: + method_obj35_2.patch

messages: + msg283566
2016-12-18 19:31:32r.david.murraysetmessages: + msg283565
2016-12-18 17:10:12Jim Fasarakis-Hilliardsetfiles: + method_obj35.patch
keywords: + patch
messages: + msg283562
2016-12-18 16:25:55r.david.murraysetnosy: + r.david.murray
messages: + msg283560
2016-12-18 16:22:52Jim Fasarakis-Hilliardsetmessages: + msg283559
2016-12-18 16:15:28woo yoosetmessages: + msg283558
2016-12-18 16:10:56Jim Fasarakis-Hilliardsetnosy: + Jim Fasarakis-Hilliard
messages: + msg283557
2016-12-18 15:50:12woo yoocreate