[Tutor] List comprehensions

Bob Gailer bgailer at alum.rpi.edu
Thu Jan 13 02:13:13 CET 2005


At 04:48 PM 1/12/2005, Kent Johnson wrote:
>If you mean for j to be a list of foobar(item) then use
>j=[foobar(item) for item in x]
>
>The first part of the list comp can be any valid expression.

Does that mean that there are invalid expressions? I'd enjoy seeing an example.

Bob Gailer
mailto:bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell 



More information about the Tutor mailing list