How to generically transform a list?

Scott David Daniels Scott.Daniels at Acm.Org
Sat Aug 28 14:43:56 EDT 2004


Marco Aschwanden wrote:

> 
> Thanks to all the hints which seem to prove that there is one and only 
> one sensible approach - though some (like me) needed a few more lines.
> 
> It is just funny how easy horizontal slicing is made (list[:]) but how 
> "difficult" vertical slicing is. It is a common task and one does not 
> realize how often one does need vertical slicing. eg.: getting the keys 
> of dictionary is a vertical slicing, or turning a list into a dict 
> involves vertical slicing...
> 
> Just out of pure curiosity: Is there a langue that allows vertical and 
> horizontal slicing and dicing with the same built-in pattern?
> 
> Regards,
> Marco (Eagerly awaiting the cookbook's second edition)
> 
> 
> 
Check out Numeric (for Python).  They do lots of slicing anddicing.
APL cetainly has (had?) it as its meat.
I think J is an ASCII-friendly APL variant.

-Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list