[Python-Dev] list comprehensions again...

Thomas Wouters thomas@xs4all.net
Thu, 6 Jul 2000 11:46:32 +0200

On Wed, Jul 05, 2000 at 11:52:09PM -0500, Guido van Rossum wrote:

> I'm much less sure about augmented assignments -- that's one big
> sucker of a patch!

Ah, but it fits so nicely with the rest of Python ! :) The changes to
support the new grammar, the new bytecodes and the __overload_ab__ methods
are pretty teensy, but there's a lot of code to support the in-place
operators in builtin and extension types, keeping the current API's
semantics regarding conversion and such. In fact, test_augassign is just as
large as the changes to ceval.c, and larger than those to compile.c ;)

I agree though, that it's a big sucker of a patch to take in at once. I
haven't found any bugs lately, but I don't use it that much. But it should
run perfectly with old code, even if you just change all occurances of
'x = x + y' into 'x += y'. The worst thing that happens is that

spam[something()] += other()

is not entirely the same as:

idx = something()
spam[idx] = spam[idx] + other()

but rather

val = other()
idx = something()
spam[idx] = val

because of the order of argument evaluation. But this shouldn't come as a
suprise to anyone who has ever looked at the order of argument evaluation (I
hadn't, before this) because it is exactly the same order as:

spam[something()] = other()

Would it help if I delivered it one piece at a time ? ;) I would suggest
against adding augmented assignment in 2.0 if it went by the by-now-old
schedule of the first beta at july 1st, because this patch can certainly use
a full beta cycle to find out if any bugs lurk, but if 2.0 is months away,
2.1 is even more months away. But then, I have no idea about the problems
which delay the 2.0 beta cycle, so I shouldn't be making assumptions ;P

Advocating-ly y'rs,
Thomas Wouters <thomas@xs4all.net>

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