Class Friends

Jacek Generowicz jacek.generowicz at
Mon Aug 30 09:41:15 CEST 2004

Jeremy Bowers <jerf at> writes:

> In Python, there isn't much of an idea of "Private";

**** ALERT: Rantbot trigger activation 8986232 ****

Rant title: Encapsulation and access restriction are orthogonal

Rant variant: Python.

Rant summary:

  The concept of privacy existis in Python. Please don't confuse
  privacy with access restriction.

  Python supports encapsulation. Please don't confuse encapsulation
  with access restriction.

  Encapsulation is data abtraction; access restriction is a pain in
  the arse.

Rant body:


> Some people would use "self.__x", to get the psuedo-private name
> munging invoked.

... access restriction for the really dense.

If the programmer is too dumb to figure out the name mangling scheme
and work around it, then he (and the project he is working on) has
some serious problems, to the extent that accessing private data when
he shouldn't becomes but a drop in the ocean.

More information about the Python-list mailing list