Duncan Booth <[EMAIL PROTECTED]> writes:

> Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
>
>> The current implementation of += uses __add__ for addition and
>> __iadd__ for addition that may or may not be in-place.  I'd like to
>> know the rationale for that design.
>> 
>
> Apart from the obvious short answer of being consistent (so you don't 
> have to guess whether or not a+=b is going to do an assignment), I think 
> the decision was partly to keep the implementation clean.

The implementation, by necessity, supports a lot of historical cruft,
so keeping it clean was not a priority.  (This is not a criticism, I
like how they kept backward compatibility.)

> Right now an inplace operation follows one of three patterns:
[...]

Thanks for pointing it out; I didn't realize just how much work went
into the new assignment opcodes.  Given the complexity, it's a wonder
they're there at all!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to