enhancing slicing

Chris Barker chrishbarker at home.net
Mon Aug 27 20:29:59 EDT 2001


Markus Schaber wrote:

> >>>> [l[i] for i in range(len(l)) if (i in indexes)]
> 
> Why not [l[i] for i in indexes] ?

because I'm an idiot... 

This simple notation indicates why list comprehensions are so nice.. but
I would still much rather it be built in.

-Chris




-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list