classification
Title: Name mangling example in Python tutorial
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: berker.peksag, chandan, cheryl.sabella, docs@python, eric.araujo, miss-islington, ned.deily, rhettinger, tim.peters, vstinner
Priority: normal Keywords: patch

Created on 2014-04-10 12:31 by chandan, last changed 2018-10-20 00:53 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
name_mangling_works.py chandan, 2014-04-10 12:31
without_name_mangling.py chandan, 2014-04-10 12:32
docs_name_mangling.patch chandan, 2014-04-14 06:48 review
issue21196.diff berker.peksag, 2016-06-02 18:53 review
Pull Requests
URL Status Linked Edit
PR 5667 merged berker.peksag, 2018-02-14 00:03
PR 9986 merged miss-islington, 2018-10-20 00:34
PR 9987 merged miss-islington, 2018-10-20 00:34
PR 9988 merged miss-islington, 2018-10-20 00:35
Messages (15)
msg215872 - (view) Author: Chandan Kumar (chandan) * Date: 2014-04-10 12:31
The example used for demonstrating name mangling could be better if two versions of code are shown - one with name mangling and one without.  I have modified the original example to incorporate this (see attached).
msg215874 - (view) Author: Chandan Kumar (chandan) * Date: 2014-04-10 12:32
Adding the second code sample, since only one attachment allowed at one go.
msg215875 - (view) Author: Chandan Kumar (chandan) * Date: 2014-04-10 12:37
Here is a link to the documentation section in question: https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references
msg215960 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-04-12 05:55
Thanks for the report and proposed fix!  Could you upload a patch file that we could directly apply to the documentation instead of Python files?  More information about how to do that is found here: https://docs.python.org/devguide/#quick-start

If you need any kind of help, the devguide has the address of the core-mentorship mailing list where many friendly people can answer questions.  You can also ask in this issue page.
msg216068 - (view) Author: Chandan Kumar (chandan) * Date: 2014-04-14 06:48
Uploading the patch for the improvement to the name mangling section of the Python tutorial.  Please note that the modification is much smaller than I proposed earlier.
msg266912 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-02 18:53
I think the text is fine, but the example is not needed. I've updated Chandan's patch to remove the example and tweak the text a bit.
msg312137 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-02-13 19:06
Chandan or Berker,

Any interest in making a Github pull request for this patch?
msg312158 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2018-02-14 05:40
I don't think we should advertise how to manually mangle the names.  That isn't a best practice.  The feature is automatic for a reason.
msg318891 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-07 05:04
What should we do with this issue?  Raymond, it sounds like you think the proposed PR should not be merged, is that right?  If so, should the issue and PR be closed?  Other opinions?  I would like to resolve this so we can either merge or close PR 5667.  Thanks!
msg318893 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2018-06-07 05:17
Berker Peksag's change (PR 5667) is very simple and, I think, helpful.
msg328102 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-20 00:33
New changeset 13ae4d44381a647aadd09b70b24833052659be41 by Victor Stinner (Berker Peksag) in branch 'master':
bpo-21196: Clarify name mangling rules in tutorial (GH-5667)
https://github.com/python/cpython/commit/13ae4d44381a647aadd09b70b24833052659be41
msg328104 - (view) Author: miss-islington (miss-islington) Date: 2018-10-20 00:42
New changeset 3e5bcd12f661bdf363c025b52a3d515829e64ed2 by Miss Islington (bot) in branch '3.7':
bpo-21196: Clarify name mangling rules in tutorial (GH-5667)
https://github.com/python/cpython/commit/3e5bcd12f661bdf363c025b52a3d515829e64ed2
msg328106 - (view) Author: miss-islington (miss-islington) Date: 2018-10-20 00:43
New changeset efc09a9701543f7180fc7ea0b6c45cf198c29cb8 by Miss Islington (bot) in branch '3.6':
bpo-21196: Clarify name mangling rules in tutorial (GH-5667)
https://github.com/python/cpython/commit/efc09a9701543f7180fc7ea0b6c45cf198c29cb8
msg328108 - (view) Author: miss-islington (miss-islington) Date: 2018-10-20 00:45
New changeset b0f7fa1dda61ae7519deed816993ac5d55870958 by Miss Islington (bot) in branch '2.7':
bpo-21196: Clarify name mangling rules in tutorial (GH-5667)
https://github.com/python/cpython/commit/b0f7fa1dda61ae7519deed816993ac5d55870958
msg328117 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-20 00:53
Thanks Chandan Kumar and Berker Peksag. The documentation has been clarified.
History
Date User Action Args
2018-10-20 00:53:09vstinnersetstatus: open -> closed
versions: + Python 3.6
messages: + msg328117

resolution: fixed
stage: patch review -> resolved
2018-10-20 00:45:11miss-islingtonsetmessages: + msg328108
2018-10-20 00:43:40miss-islingtonsetmessages: + msg328106
2018-10-20 00:42:01miss-islingtonsetnosy: + miss-islington
messages: + msg328104
2018-10-20 00:35:45miss-islingtonsetpull_requests: + pull_request9329
2018-10-20 00:34:09miss-islingtonsetpull_requests: + pull_request9328
2018-10-20 00:34:00miss-islingtonsetpull_requests: + pull_request9327
2018-10-20 00:33:52vstinnersetnosy: + vstinner
messages: + msg328102
2018-06-07 05:17:27tim.peterssetnosy: + tim.peters
messages: + msg318893
2018-06-07 05:04:06ned.deilysetnosy: + ned.deily
messages: + msg318891
2018-02-14 05:40:26rhettingersetmessages: + msg312158
2018-02-14 00:03:22berker.peksagsetpull_requests: + pull_request5469
2018-02-13 19:06:09cheryl.sabellasetnosy: + cheryl.sabella

messages: + msg312137
versions: + Python 3.7, Python 3.8, - Python 3.5, Python 3.6
2016-06-02 18:53:40berker.peksagsetfiles: + issue21196.diff
versions: + Python 3.6, - Python 3.4
nosy: + berker.peksag

messages: + msg266912
2014-04-14 06:48:45chandansetfiles: + docs_name_mangling.patch
keywords: + patch
messages: + msg216068
2014-04-12 05:55:10eric.araujosetversions: + Python 2.7, Python 3.4, Python 3.5
nosy: + eric.araujo

messages: + msg215960

stage: patch review
2014-04-10 12:37:10chandansetmessages: + msg215875
2014-04-10 12:32:27chandansetfiles: + without_name_mangling.py

messages: + msg215874
2014-04-10 12:31:20chandancreate