PEP 308: Pep Update

Anders J. Munch andersjm at inbound.dk
Thu Feb 27 17:31:03 EST 2003


"Sheila King" <usenet at thinkspot.net> wrote:
> I really do love the list comprehensions, myself. They are handy for a lot
> of the email header and filtering type of scripts that I write.
>
> I didn't find the example you posted confusing at all. It's just a nested
> for-loop.

Yes, I know.  Except that the innermost part of the nested loop, which
would be at the very end in a regular for-loop, is at the very
beginning.  If that has never bothered you, good for you.  For me,
that was the one part of Python that wasn't immediately obvious.

People have been implying throughout the PEP 308 debate that mixing up
the evaluation order is fine because of the analogy with list comps.
I accept the analogy but draw the opposite conclusion from it.

Pop quiz: What is the value of this alternate universe list
comprehension expression?

   [for x in (1,2): for y in (-1,+1): x*y]

- Anders







More information about the Python-list mailing list