Why less emphasis on private data?

Paul Rubin http
Sun Jan 7 10:27:22 EST 2007


Thomas Ploch <Thomas.Ploch at gmx.net> writes:
> Me neither, although I have to say that the '__' prefix comes pretty
> close to being 'private' already. It depends on the definition of
> private. For me, private means 'not accessible from outside the
> module/class'.

    class A:
      __x = 3

    class B(A):
      __x = 4   # ok

    class C(B):
      __x = 5   # oops!

Consider that the above three class definitions might be in separate
files and you see how clumsy this gets.  



More information about the Python-list mailing list