Is it just Syntactic Sugar ?

Thomas Wouters thomas at xs4all.net
Tue May 30 16:32:43 EDT 2000


On Tue, May 30, 2000 at 01:12:53PM -0700, Johann Hibschman wrote:

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

Why do you need a rewrite ? It can *function* like a rewrite for immutable
types, and that is indeed the only way it can function. But it shouldn't be
a macro-type rewrite by the compiler, because then you can't do an in-place
add with mutable types. The compiler doesn't know what variable is what
type!

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list