Skip Montanaro <s...@pobox.com> added the comment:

Maybe the wording should be changed, but name mangling serves a useful
purpose.  There are two definitions of "private" which seem to be a
bit conflated in this section:

* "private" as in, "this name is not part of the public API - use it
  at your own risk".

* "private" as in, "I don't want someone to accidentally stomp on this
  attribute name when subclassing this class".

I think it is valuable to mention both of these conventions in the
tutorial for a couple reasons:

* the tutorial is meant for people new to Python but with experience
  in other programming languages

* the distinction between _a and __a is a bit subtle and not obviously
  similar to privacy features present in other languages.

I work with a lot of C++ programmers who also write some Python
(sometimes a lot of Python).  It's clear at times that the distinction
hasn't always sunk in.

----------
nosy: +skip.montanaro

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8638>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to