Does Python really follow its philosophy of "Readability counts"?
pavlovevidence at gmail.com
Mon Jan 12 01:44:27 CET 2009
On Jan 11, 5:41 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Carl Banks <pavlovevide... at gmail.com> writes:
> > > The criticism is very valid. Some languages do support immutable
> > > variables (e.g. "final" declarations in Java, "const" in C++, or
> > > universal immutability in pure functional languages) and they do so
> > > precisely for the purpose of taming the chaos of uncontrolled
> > > mutation. It would be great if Python also supported immutability.
> > I don't think what you said (which is fine) makes his criticism valid,
> > unless you also suggest that all objects should be immutable.
> It would be enough to have a way to make specific objects and instance
> attributes immutable.
Enough for what, to make the guy's criticism valid? No it wouldn't.
Or are you just ignoring the OP altogether and complaining about what
For my part I am concerned with answering the OP's issues here, not
> > 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.
The OP wasn't complaining about the fact that objects aren't
immutable, as far as I can tell, nor about having public and private
variables, so I can't agree Python's lack of these has anything to do
with the OP's concerns.
More information about the Python-list