[Tutor] List comprehensions

Liam Clarke cyresse at gmail.com
Wed Mar 23 11:43:39 CET 2005


Is there a way to apply multiple actions within one list comprehension?

i.e. instead of 

a = []
for i in x:
    g = [ int(item) for item in i]

Is there any guides to this (possibly obtuse) tool?


Liam Clarke

PS I can see how nested list comprehensions can quickly lose readability. 

'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.

More information about the Tutor mailing list