Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Mar 22 06:40:49 EDT 2014


On 22/03/2014 02:06, Rustom Mody wrote:
>
> The same in haskell:
>
> Prelude> let fl = [\ y -> x + y | x <- [1,2,3]]
> Prelude> [(fl!!i) 0 | i<- [0,1,2]]
> [1,2,3]
>

My really big complaint about Python is that it's nothing like CORAL 66. 
  I think I'll raise this on python ideas in an attempt to get this 
glaring deficiency corrected.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com





More information about the Python-list mailing list