Chris Angelico wrote: > Here's the equivalent as a list comprehension, which I think looks > better than either of the above: > [x + 1 for x in [1,2,3] if x % 2 == 0]
That's not equivalent. You produce [3] instead of [2, 4]. So you rather proved that the proposal does have merit, as it's apparently easy to get the list comprehension wrong. Actually equivalent list comprehension: [x for x in [1,2,3] for x in [x + 1] if x % 2 == 0] Or spread across lines: [x for x in [1,2,3] for x in [x + 1] if x % 2 == 0] _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ZY4RN57VWJUIJJI4YS36AOQZYGMXWZZQ/ Code of Conduct: http://python.org/psf/codeofconduct/