Scope rule pecularities

Antoon Pardon apardon at forel.vub.ac.be
Thu May 13 03:58:07 EDT 2004


Op 2004-05-13, Greg Ewing schreef <greg at cosc.canterbury.ac.nz>:
> Antoon Pardon wrote:
>>>   x = 42
>>>   x += 1
>>>
>>>which is a very handy thing to be able to do.
>> 
>> But it creates confusions because the semantics
>> is not consistent.
>
> Practicality beats purity, though, and this does seem
> to be very practical.

Well one could drop the immutability of certain classes
instead. One would then loose the immutabilty purity
and gain the consistency purity. In a choice between
those two purities I would choose the latter.

But I don't expect python development to follow
my preference.

> Besides, the semantics are as consistent as anything
> else in Python, where the objects being operated on
> get to determine the meaning of just about everything.

So? Would you argue that the devellopers could just
as easily have implemented "a += b" as equivallent to
"a = a - b" with half of the core classes and called that
just as consistent as choosing it equivallent to
"a = a + b" for all core classes because the objects
being operated on get to determine the meaning?

-- 
Antoon Pardon



More information about the Python-list mailing list