On Fri, Aug 11, 2017 at 6:53 AM, Serhiy Storchaka <storch...@gmail.com> wrote: > 10.08.17 23:28, Ian Kelly пише: >> >> So, perhaps a better syntax could be: >> >> [x + 1 for x in (0, 1, 2, 999, 3, 4) if x < 5 else break] > > > (0, 1, 2, 999, 3, 4) if x < 5 else break > > looks too similar to the ternary operator.
It is entirely intentional and a point in its favor, in my view, that "x + 1 ... if x < 5 else break" resembles the ternary operator, as it basically is a special syntax of that. But I take your point that it also resembles the ternary in "(0, 1, 2, 999, 3, 4) if x < 5 else break", which could lead to some confusion. -- https://mail.python.org/mailman/listinfo/python-list