On Tue, Oct 18, 2016, at 04:01, Daniel Moisset wrote: > I see some mention that flatten does not cover all cases; but correct > me if I'm wrong with this statement: > > Any case of [*<exp1> for <vars> in <exp2>] could be replaced with > flatten(<exp1> for <vars> in <exp2>). Where flatten is defined as > > def flatten(it): > return [x for for subit in it for x in subit]
That is correct - though flatten as previously discussed did not return a list, so list(flatten(...)) was required, though I suppose you could use [*flatten(...)] - my point was that [especially with the list constructor] this is significantly more verbose than the proposed syntax. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/