BUG? list-comprehension's inconsistency? was: Re: list-display semantics?

Remco Gerlich scarblac at pino.selwerd.nl
Mon Jun 11 03:28:43 EDT 2001
Roman Suzi <rnd at onego.ru> wrote in comp.lang.python:

(snippage)

> 3->>> [[x for x in [1, 2, 3]], [y for y in [4, 5, 6]]]
> [[1, 2, 3], [4, 5, 6]]
> 
> (it was a discovery to me to know that I can delimit
> naked list comprehensions by "," inside list definitions!)

>>> [1, 2]
[1, 2]
>>> [[1,2,3], [4,5,6]]
[[1,2,3], [4,5,6]]
>>> [[x for x in in [1, 2, 3]], [y for y in [4, 5, 6]]]
[[1,2,3], [4,5,6]]

That is, you just rediscovered something you already knew :)

-- 
Remco Gerlich



More information about the Python-list mailing list