[Python-ideas] Tuple Comprehensions

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Oct 10 23:26:15 CEST 2011


Karthick Sankarachary wrote:
> For one thing, list comprehensions don't let you 
> create immutable sequences (such as a tuple) by design. For another, it 
> does not provide a concise alternative to reduce() function.

There was a big discussion a while back about a syntax for
reduction operations. The conclusion reached was that the
concept of reduction has so many degrees of freedom that,
beyond the very simple cases covered by the reduce() function,
nothing is clearer than simply writing out the loop explicitly.

-- 
Greg



More information about the Python-ideas mailing list