Bug or feature?

James Henderson james at logicalprogression.net
Fri Jan 16 11:13:06 EST 2004


On Friday 16 January 2004 2:44 pm, Alexey Nezhdanov wrote:
<snip>
> I know the case where such python behaivoir causes hard-to-catch problems.
> I do not know any case (anybody knows? please give example) where such
> "feature" may be useful.
>
> So I proposing to make a change into python and reverse the order of
> calculations.
> Just for sure:
> === Order used now ===
> ## a+=a.Sub(b)
> 1. evaluate value of 'a'
> 2. evaluate value of 'a.Sub(b)'
> 3. evaluate the sum
> 4. store the result into 'a'
> === Proposed order ===
> ## a+=a.Sub(b)
> 1. evaluate value of 'a.Sub(b)'
> 2. evaluate value of 'a'
> 3. evaluate the sum
> 4. store the result into 'a'

-1
In any language that uses such an operator I would expect:

a += b

to be synonymous with:

a = a + b

You are suggesting that it should mean:

a = b + a

It is not like Python to attach its own idiosyncratic semantics to operators 
already well known from other languages.  I think this would catch a lot of 
people out.

Of course, it's probably best to avoid writing code where the order makes a 
difference. :)

James
-- 
James Henderson, Logical Progression Ltd.
http://www.logicalprogression.net/





More information about the Python-list mailing list