[Tutor] List comprehensions

Kent Johnson kent37 at tds.net
Thu Jan 13 03:05:24 CET 2005


I suppose if it's an expression, it must be valid, eh? Otherwise it's something else.

Bob Gailer wrote:
> 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