PATCH: Augmented assignment
Doug Stanfield
DOUGS at oceanic.com
Sat Jun 10 17:42:45 EDT 2000
[Christian Tanzer wrote:]
> > It doesn't obfuscate code looking like:
> >
> > nested_structure [some_index] [another_index] =
> nested_structure [some_index] [another_index] + 1
> >
> > And it saves more than a few keystrokes.
[Moshe Zadka replied:]
> Anyone doing *that* isn't familiar with the pydiom:
>
> s, i = nested_strucre[some_index], another_index
> s[i] = s[i] + 1
Wow, I like that. Its great!!!
Could you pass on the link to that storehouse of great pydioms.
I'd like to see more ;-Q
but-I-guess-the-point-was-there's-usually-already-a-clearer-way-to-write-it'
ly yr's
-Doug-
More information about the Python-list
mailing list