reduce to be removed?

Robert Kern robert.kern at gmail.com
Sat Nov 11 20:59:20 EST 2006


Dustan wrote:
> Fredrik Lundh wrote:

>> if you care about writing robust code, why not just use a for-loop,
>> and the list extend method?
> 
> Because I'm embedding this expression in a list comprehension (as I
> stated in my original post), and last time I checked, it's not possible
> to treat a for-loop as an expression (which is what a list
> comprehension requires).

As with all such things, you stick the implementation in a well-named function
and simply call the function everywhere. The implementation never needs to be a
one-liner expression.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list