Recursive list comprehension

Peter Hansen peter at engcorp.com
Mon Dec 6 19:12:15 CET 2004


Timothy Babytch wrote:
> Serhiy Storchaka wrote:
> 
>  >>>sum([['N', 'F'], ['E'], ['D']], [])
> ['N', 'F', 'E', 'D']
> 
> THE BEST!

Hmmm.  Maybe, unless readability as in "self-documenting code"
is important to you...

Preceding the above with "flatten = sum" would perhaps be
an adequate improvement.

-Peter



More information about the Python-list mailing list