Does Python really follow its philosophy of "Readability counts"?

Chris Rebert clp2 at
Mon Jan 12 00:58:54 CET 2009

On Sun, Jan 11, 2009 at 3:41 PM, Paul Rubin
<""@nospam.invalid> wrote:
> Carl Banks <pavlovevidence at> writes:
>> If any objects are mutable, you have to be prepared for objects to
>> mutated outside the initializer.
> Sure, but why have mutable objects all over the place?  And, why
> always have attributes visible at all, outside the class definition?
> The approach in C++ and Java is to have public and private instance
> variables, where the private ones are visible only in the class methods.

Regarding the second question, Python adheres to the principle that
"We're all consenting adults here" and so does not provide complete
encapsulation like more B&D languages. This is handy sometimes as it
allows one to break through the encapsulation when necessary and
fiddle with the internals. This is not to say that breaking
encapsulation willy-nilly is advised, but it does allow for some neat
hackery every now and again.


Follow the path of the Iguana...

More information about the Python-list mailing list