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

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Mon Jan 12 15:06:46 EST 2009


Paul Rubin a écrit :
> Carl Banks <pavlovevidence 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.
> 
>> 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.

Why on earth are you using Python if you don't like the way it work ???



More information about the Python-list mailing list