Modifying every alternate element of a sequence

Leo Kislov Leo.Kislov at gmail.com
Tue Nov 28 13:30:17 CET 2006


jm.suresh at no.spam.gmail.com wrote:
> Wow, I was in fact searching for this syntax in the python tutorial. It
> is missing there.
>  Is there a reference page which documents all possible list
> comprehensions.

There is actually only two forms of list comprehensions:
http://docs.python.org/ref/lists.html
[blah for x in expr] and [blah for x in expr if cond]

And here is reference page for slicing (note, it's not list
comprehension): http://docs.python.org/ref/slicings.html

  -- Leo




More information about the Python-list mailing list