PATCH: Augmented assignment

Christian Tanzer tanzer at swing.co.at
Sun Jun 11 02:23:51 EDT 2000


Moshe Zadka <moshez at math.huji.ac.il> wrote:

> On Sat, 10 Jun 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.
> 
> Anyone doing *that* isn't  familiar with the pydiom:
> 
> s, i = nested_strucre[some_index], another_index
> s[i] = s[i] + 1

I'm familiar with the pydiom and I consider it one of Python's strong
points.

But I want to keep complex algorithms as short as possible. Adding
another line to unpack doesn't always increase readability.

Use-the-right-tool-for-the-job-ly y'rs, 

-- 
Christian Tanzer                                         tanzer at swing.co.at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92





More information about the Python-list mailing list