[Tutor] List comprehensions

Liam Clarke cyresse at gmail.com
Wed Mar 23 21:56:37 CET 2005


Geez, that's pretty bad. I've got to stop playing with code when I'm tired. 
Thanks all.




On Wed, 23 Mar 2005 20:24:32 -0000, Alan Gauld <alan.gauld at freenet.co.uk> wrote:
> > Is there a way to apply multiple actions within one list
> comprehension?
> 
> Write a function?
> 
> def foo(i):
>    # do stuff to i
>    return i
> 
> [foo(i) for i in alist]
> 
> Alan G.
> 
> 


-- 
'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