Web Images Videos Maps News Shopping Google Mail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Will python never intend to support private, protected and public?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Fredrik Lundh  
View profile   Translate to Translated (View Original)
 More options 28 Sep 2005, 16:45
Newsgroups: comp.lang.python
From: "Fredrik Lundh" <fred...@pythonware.com>
Date: Wed, 28 Sep 2005 17:45:37 +0200
Local: Wed 28 Sep 2005 16:45
Subject: Re: Will python never intend to support private, protected and public?

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>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google