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

Marko Rauhamaa marko at pacujo.net
Mon Apr 7 01:14:52 EDT 2014


Steven D'Aprano <steve at pearwood.info>:

> That's why optimizers like PyPy generally produce code like this:
>
>     if some guard condition is true:
>         run fast optimized branch
>     else:
>         fall back on standard Python 

There you go! You are using Python-esque syntax to communicate a CS
idea.


Marko



More information about the Python-list mailing list