Re: Will python never intend to support private, protected and public?

Discussion in 'Python' started by Simon Brunning, Sep 28, 2005.

  1. On 9/28/05, Tony Meyer <> wrote:
    > I'm not sure why I haven't seen this mentioned yet, but a leading
    > double-underscore does really make a member private:


    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. It can be used to make things private, true, but
    that's abusing the feature, just as using __slots__ as a way of
    "declaring variables" is an abuse - (__slots__ is a memory
    optimisation feature).

    --
    Cheers,
    Simon B,
    ,
    http://www.brunningonline.net/simon/blog/
     
    Simon Brunning, Sep 28, 2005
    #1
    1. Advertising

  2. Simon Brunning

    Paul Rubin Guest

    Simon Brunning <> writes:
    > 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. It can be used to make things private, true, but
    > that's abusing the feature, just as using __slots__ as a way of
    > "declaring variables" is an abuse - (__slots__ is a memory
    > optimisation feature).


    Good explanation.
     
    Paul Rubin, Sep 28, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Holden
    Replies:
    2
    Views:
    338
    Alex Martelli
    Oct 8, 2005
  2. Simon Brunning
    Replies:
    10
    Views:
    503
    Alex Martelli
    Oct 8, 2005
  3. Tony Meyer
    Replies:
    2
    Views:
    389
    Tony Meyer
    Sep 28, 2005
  4. Chris Gonnerman
    Replies:
    158
    Views:
    2,177
    Paul Rubin
    Oct 5, 2005
  5. Tony Meyer
    Replies:
    0
    Views:
    414
    Tony Meyer
    Sep 29, 2005
Loading...

Share This Page