Nick Craig-Wood wrote:

>     x += a
> 
> does not equal
> 
>     x = x + a
> 
> which it really should for all types of x and a

Actually, this will *never* be the case for classes that do in-place
augmented assignment.

    a = [1]
    b = [2]

    c = a + b
    print a, b, c

    a += b
    print a, b, c

You'll note that I didn't rebind 'a' in the non-augmented assignment. If
you do, augmented and non-augmented assignment may look the same, but
they can be very different.

Tim Delaney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to