PATCH: Augmented assignment

Thomas Wouters thomas at xs4all.net
Sat Jun 10 15:43:19 EDT 2000


On Sat, Jun 10, 2000 at 03:22:19PM -0400, Paul Magwene wrote:
> Christian Tanzer wrote:

> > It doesn't obfuscate code looking like:

> >    nested_structure [some_index] [another_index] = nested_structure [some_index] [another_index] + 1

> Please tell me you're not REALLY writing code that looks like that, when
> something like:
> 
> 	nested[i][j] = nested[i][j] + 1

> will do just as well (and is a lot easier to read).

*Please* tell me you aren't really using variable names like 'i' and 'j' in
large programs ? Sure, they're fine for loop counters, but you dont always
index large structures with those.

Anyway, as has been said before, the issue is not saving the few keystrokes,
the issue is obvious in-place modification; syntax that is both clear in
what it means, and how it is different from 'x = x + 1'.

> Undecided-on-augmented-assignment-l'y yours,

Well, to be truthful, I'm undecided on augmented assignment myself, and I'll
stay undecided until Guido accepts it ;) I like the syntax very much, but
that doesn't an sich mean it should go in Python. I'll let Guido be the
judge of that, and trust others to make sure Guido knows what he decides ;)

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