[PEP202 listcomps] (was RE: [Python-Dev] Product iteration)

Thomas Wouters thomas@xs4all.net
Wed, 26 Jul 2000 22:02:17 +0200

On Wed, Jul 26, 2000 at 08:00:33AM -0500, Guido van Rossum wrote:
> > is there any special reason why we cannot use colon instead
> > of "for"?

> Would conflict with the proposed syntax for range literals.  Both
>   [0:10]
> and

>   [x : x in seq]

> have the same syntactical form.

Much, much worse: the latter *is* a range literal. It's not likely to
produce anything useful, depending on 'x', but it is a valid range literal.

(It'll create a range from 'x' to '0', if 'x' is not in 'seq', or '1', if
'x' is in 'seq', using step 1.)

Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!