On Sat, Jul 30, 2016 at 10:11 PM, Rustom Mody <rustompm...@gmail.com> wrote: >> > - Poorer error catching: What was a straight syntax error is now a >> > lint-catch (at best) >> > [print (x) for x in range(20)] >> >> Huh? Aside from the fact that you're constructing a useless list of >> Nones, what's the error? > > Huh² > > Are you seriously suggesting that python-3’s behavior below is better IN > THIS INSTANCE than python-2’s? > > [That there may be other reasons that outweigh this one for print-as-function > is not something I am disputing. I was solely disputing your ‘just’] > > Python 2.7.12 (default, Jul 1 2016, 15:12:24) >>>> [print(x) for x in range(10)] > File "<stdin>", line 1 > [print(x) for x in range(10)] > ^ > SyntaxError: invalid syntax >>>> > > Python 3.5.2 (default, Jul 5 2016, 12:43:10) > >>>> [print(x) for x in range(10)] > 0 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > [None, None, None, None, None, None, None, None, None, None] >>>>
I still don't understand your complaint. How is this "better/worse error checking"? All you're showing me is the same line of code you showed above, plus what it does in Py2 and Py3, which I know already. You haven't explained why this is such a great feature in Py2 that got lost in Py3. And hey. If you want to print out the numbers 0 through 9, Py3 offers a pretty concise way to spell that: >>> print(*range(10), sep='\n') 0 1 2 3 4 5 6 7 8 9 >>> Beat that, print statement. ChrisA -- https://mail.python.org/mailman/listinfo/python-list