[Tutor] List comprehensions

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


Hi, 

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

i.e. instead of 

a = []
for i in x:
    i.pop(3)
    g = [ int(item) for item in i]
    a.append(g)

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

Regards, 

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