Is it just Syntactic Sugar ?

Michael Hudson mwh21 at
Tue May 30 16:35:25 EDT 2000

Johann Hibschman <johann at> writes:

> Thomas Wouters writes:
> > No, I have more faith in the idea that += is an *in place* add, for mutable
> > types.
> But then it loses its most basic utility, namely working with
> integers.  An integer is not a mutable type.
> A simple rewrite is the only way to make sense of
>   i += 1  -> i = i + 1
> if i is an integer, given the existing python variable semantics.

But it's not the only way to make sense of

a.b.c[item(d)] += e

which you'd like to be roughly equivalent to

t1 = a.b.c
t2 = item(d)
t1[t2] = t1[t2] + e



depending on whether a.b.c is an instance that implement the
appropriate magic or not.


  Arrrrgh, the braindamage!  It's not unlike the massively
  non-brilliant decision to use the period in abbreviations 
  as well as a sentence terminator.  Had these people no 
  imagination at _all_?                 -- Erik Naggum, comp.lang.lisp

More information about the Python-list mailing list