Bug or feature?

Robert Brewer fumanchu at amor.org
Fri Jan 16 16:46:09 CET 2004


Alexey wrote:
> Does anybody agree that this is a python problem and not a programmer 
> problem?

I don't agree. The programmer has a problem stuffing too much activity
into a single expression. Why return a value from a method (your 'delta'
arg) when you just sent that value to the method? But I'll give further
advice anyway... :)

> 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'

You'll have to be more rigorous than that in your description. Given
this single instance, you might be proposing:

1) Evaluate right-to-left instead of left-to-right?
2) Evaluate a.method before a.attribute?
3) Evaluate all calls before all LOAD_FAST?
4) Change the order only for +=? So a = a + a.Sub(b) would be unchanged,
or not?

What happens if a programmer writes:

## a = a + a.Sub(b)
## a = a + a.Sub(b) + a
## a += a.Sub(b) + a + a.Mult(b)?

and on and on.


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org




More information about the Python-list mailing list