list displays

Chris Rebert clp2 at rebertia.com
Sat Jan 8 17:26:03 EST 2011


On Sat, Jan 8, 2011 at 1:57 PM, Olive <not0read0765 at yopmail.com> wrote:
> I am a newbie to python. Python supports what I thinks it is called
> list display, for example:
>
> [i for i in range(10)]
> [i for i in range(10) if i<6]
>
> Does anyone know a good documentation for this. I have read the
> language reference but it is confusing.

You may find the translation to equivalent list-comprehension-free
code in http://docs.python.org/howto/functional.html#generator-expressions-and-list-comprehensions
helpful.

Cheers,
Chris



More information about the Python-list mailing list