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

Chris Angelico rosuav at gmail.com
Mon Apr 7 23:02:37 EDT 2014


On Tue, Apr 8, 2014 at 11:33 AM, Mark H Harris <harrismh777 at gmail.com> wrote:
> Does a function (or generator) 'do' something (based on name and parms) or
> does it 'return' something based on name and parms?

If it has no side effects, then it does something, where the
'something' is returning a value. "Return" is a verb.

(It can also be a noun, but in the context of functions, it's a verb.)

ChrisA



More information about the Python-list mailing list