News for hackers. Stuff that matters.
Re:Is Python the Future of Programming? by cheez on Saturday July 21, 2018 @06:59PM (#17584316)
`foo._a` accessible outside `Foo` but it makes code look gross and means you're doing something wrong.

`foo.__a` accessible only inside `Foo`

I think it works.

Re:Is Python the Future of Programming? by culturedsystems on Saturday July 21, 2018 @07:54PM (#17584507)
> `foo.__a` accessible only inside `Foo`

It's not all that inaccessible. Try:

    class C:
      def __init__(self):
        self.__private = 'Is it private?'
    
    c = C()
    c._C__private
Double underscore names aren't so much about access control (because access control isn't strongly enforced) as about limiting name collisions (by including the class name in the underlying field name).
Re:Is Python the Future of Programming? by dragonwriter on Saturday July 21, 2018 @09:53PM (#17584858)
Specifically, it's about avoiding collision of "private" names via inheritance.