Howto flaten a list of lists was (Explanation of this Python language feature)

Mark H Harris harrismh777 at gmail.com
Fri Mar 28 23:23:51 CET 2014


On 3/28/14 5:12 PM, Mark Lawrence wrote:
>>
>> No. This has to be a better way to flatten lists:
>>
>>  >>> from functools import reduce
>>
>>  >>> import operator as λ
>>
>>  >>> reduce(λ.add, l)
>> [1, 2, 3, 4, 5, 6, 7, 8, 9]
>>
>
> Why reinvent yet another way of flattening lists, particulary one that
> doesn't use the far more sensible:-

    { particularly }

>
> from operator import add
>
> As for the stupid symbol that you're using, real programmers don't give
> a damn about such things, they prefer writing plain, simple, boring code
> that is easy to read.

:-))    as RMS would say, "playful hacking, dude, playful hacking..."







More information about the Python-list mailing list