PATCH: Augmented assignment

Christian Tanzer tanzer at swing.co.at
Sun Jun 11 02:16:50 EDT 2000


Paul Magwene <paul.magwene at yale.edu> 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).

I always try to use the shortest possible names. But I avoid using
names which are meaningless.

If `i' and `j' are just plain loop indices (i.e., numbers), I would be
pretty annoyed if someone used `i_loop_variable' (I actually saw that
once in a FORTRAN program).

OTOH, if the indices select from a dictionary and the expression is
part of some complicated algorithm, I'd rather use expressive names --
and this usually are longer than 1 character.

Please-don't-jump-to-premature-conclusions-when-reading-a-quickly-made-up-
example-l'y yours,
Christian

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