Message from discussion
Will python never intend to support private, protected and public?
Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.vmunix.org!newsfeed.stueberl.de!newsgate.cistron.nl!transit.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path: <python-python-l...@m.gmane.org>
X-Original-To: python-l...@python.org
Delivered-To: python-l...@bag.python.org
X-Spam-Status: OK 0.002
X-Injected-Via-Gmane: http://gmane.org/
To: python-l...@python.org
From: "Fredrik Lundh" <fred...@pythonware.com>
Subject: Re: Will python never intend to support private, protected and public?
Date: Wed, 28 Sep 2005 17:45:37 +0200
References: <311b5ce105092800102da32267@mail.gmail.com><8c7f10c605092804053a6eadf4@mail.gmail.com><813D949A-554B-4801-BE07-13F652A218AD@ihug.co.nz><8c7f10c605092804552f1dac9@mail.gmail.com>
<00C39639-DDD6-41A7-BEA9-F78EFA3288A5@ihug.co.nz>
X-Gmane-NNTP-Posting-Host: c83-250-11-33.bredband.comhem.se
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
Sender: news <n...@sea.gmane.org>
X-BeenThere: python-l...@python.org
X-Mailman-Version: 2.1.6
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list>
List-Post: <mailto:python-l...@python.org>
List-Help: <mailto:python-list-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-requ...@python.org?subject=subscribe>
Newsgroups: comp.lang.python
Message-ID: <mailman.1093.1127922522.509.python-list@python.org>
Lines: 45
NNTP-Posting-Host: 194.109.207.14
X-Trace: 1127922523 news.xs4all.nl 11070 [::ffff:194.109.207.14]:44596
X-Complaints-To: abuse@xs4all.nl
Tony Meyer wrote:
>> I thought about it, but I didn't mention it in the end because this
>> feature ("name mangling") isn't intended as a mechanism for making
>> things private - it's intended to prevent namespace clashes when doing
>> multiple inheritance.
>
> That's not what the documentation says:
>
> """
> 9.6 Private Variables
>
> There is limited support for class-private identifiers.
> [...]
> Name mangling is intended to give classes an easy way to define
> ``private'' instance variables and methods,
> [...]
> """
>
> <http://docs.python.org/tut/node11.html>
the sentence you're quoting the first part of continues:
without having to worry about instance variables defined by derived
classes
and the paragraph later says:
Note that the mangling rules are designed mostly to avoid accidents
and both sentences are from the *tutorial*, which doesn't exactly
qualify as a design document. if you want more rationale, here's the
post that led to the current design:
http://groups.google.com/group/comp.lang.python/msg/e79f875059d9a2ba
"In my version, private data has it's own scope, so that name clashes
will not occur if a private with the same name is used in a subclass."
see the rest of that thread for more about the history of __.
</F>