x[i] as loop variable
Just
just at xs4all.nl
Thu Oct 23 16:34:19 EDT 2003
In article <yRWlb.17437$Fc5.1106 at nwrdny01.gnilink.net>,
"Raymond Hettinger" <vze4rx4y at verizon.net> wrote:
> [Gerrit Holl]
> > PEP 289 says:
> > (Loop variables may also use constructs like x[i] or x.a; this form may be
> deprecated.)
>
> That was taken out of the pep because it is a distractor issue.
>
>
> > What is the use of this? When should I use it?
>
> In general, it should never be used unless you're trying to obfuscate
> your code. It is a long standing, unintended by-product of the
> grammar that any lvalue can be used as a loop variable. Most folks
> aren't aware of it and everyone is better off not knowing about it.
> In fact, I wish it hadn't come-up at all because someone will read
> about it and adopt the atrocity as their new favorite style.
But isn't the feature a neccesity to make this work:
for a, b in zip(seqA, seqB):
...
?
Just
More information about the Python-list
mailing list