Appliying method to list of objects

Greg Ewing see at my.signature
Fri Jun 1 01:24:52 EDT 2001


Alex wrote:
> 
> You could do this in python2:
> 
> [x.dosomething() for x in list]

I can't see how that can be regarded as any
better. It's no clearer, and it wastes time
doing unnecessary work -- i.e. building a
list and then throwing it away.

Same goes for using map().

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list