[issue30597] Show expected input in custom "print" error message

2017-07-03 Thread Nick Coghlan
Nick Coghlan added the comment: And merged. Thanks all! -- stage: backport needed -> resolved status: open -> closed ___ Python tracker ___ __

[issue30597] Show expected input in custom "print" error message

2017-07-03 Thread Nick Coghlan
Nick Coghlan added the comment: New changeset bfdc6fdc0e76204caf2261f9cfa9d232fc23906a by Nick Coghlan in branch '3.6': [3.6] bpo-30597: Show expected input in custom 'print' error message. (GH-2531) https://github.com/python/cpython/commit/bfdc6fdc0e76204caf2261f9cfa9d232fc23906a --

[issue30597] Show expected input in custom "print" error message

2017-07-01 Thread Nick Coghlan
Changes by Nick Coghlan : -- pull_requests: +2598 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue30597] Show expected input in custom "print" error message

2017-07-01 Thread Nick Coghlan
Changes by Nick Coghlan : -- assignee: -> ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue30597] Show expected input in custom "print" error message

2017-06-30 Thread Ned Deily
Ned Deily added the comment: While it's debatable, I think one can make something of a case for this being a usability bug rather than a new feature. Given the impact to new users of Python 3 and the apparent relative low risk of the change, I'll go out on a bit of a limb and allow it for 3.6

[issue30597] Show expected input in custom "print" error message

2017-06-20 Thread Nick Coghlan
Nick Coghlan added the comment: Also adding Ned to the nosy list, since it's ultimately his call as the 3.6 release manager. Ned: the context here is that we just landed an improvement to the custom error message for Py2-style print syntax that also says how to fix the problem, rather than ju

[issue30597] Show expected input in custom "print" error message

2017-06-20 Thread Nick Coghlan
Nick Coghlan added the comment: Oops, having written the above comment, I belatedly remembered why I originally suggested this be handled as a maintenance issue rather than as a regular enhancement: I'd like to backport it to the Python 3.6 stack in Fedora, and I think it's better to do that k

[issue30597] Show expected input in custom "print" error message

2017-06-20 Thread Nick Coghlan
Nick Coghlan added the comment: A note regarding the applicable versions: for the original custom warning, we decided it made sense to change it in a maintenance release, since the generic syntax error really was incredibly cryptic, and we wanted to get the update into the hands of users as qu

[issue30597] Show expected input in custom "print" error message

2017-06-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Actually end=' ' in Python 3 is not exact replacement of the trailing comma in Python 2. But it covers most of cases. The difference is too subtle and too subtle for the user that makes an error of using Python 2 syntax in Python 3. -- _

[issue30597] Show expected input in custom "print" error message

2017-06-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

[issue30597] Show expected input in custom "print" error message

2017-06-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 3a7f03584ab75afbf5507970711c87042e423bb4 by Serhiy Storchaka (Sanyam Khurana) in branch 'master': bpo-30597: Show expected input in custom 'print' error message. (#2009) https://github.com/python/cpython/commit/3a7f03584ab75afbf5507970711c87042e

[issue30597] Show expected input in custom "print" error message

2017-06-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- components: +Interpreter Core stage: needs patch -> commit review versions: -Python 3.6 ___ Python tracker ___ _

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Nick Coghlan
Nick Coghlan added the comment: It looks like the current right-shift error message is already distinctive enough to get people to answers explaining the culprit: https://www.google.com.au/search?q=TypeError:+unsupported+operand+type(s)+for+>>:+'builtin_function_or_method'+and+'_io.TextIOWrappe

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, re-reading the comments when reviewing Sanyam's patch, I just remembered the problem with the "print >> sys.stderr, output" case, which is that it isn't a syntax error, it's a runtime type error: ``` >>> print >> sys.stderr, "message" Traceback (most recent

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Nick Coghlan
Nick Coghlan added the comment: Eric, right, I left a couple of logical leaps out of my reply as well. My first thought was the same as yours but then I went: - that means we need to split on commas - which means we need to track whether or not we're inside a quoted string or not - which is pr

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Sanyam Khurana
Changes by Sanyam Khurana : -- pull_requests: +2075 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Eric V. Smith
Eric V. Smith added the comment: That sounds good to me. Just to elaborate on my earlier message, since it might have been too terse: I think it would be misleading to give in error at: print >>sys.stderr, "message" and say: Did you mean 'print("message")'? since they're not equivalent. If y

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Nick Coghlan
Nick Coghlan added the comment: Those are easy enough to check with strncmp() even in C, so we could make them manageable by just including "" in the error message, rather than the full text of the original statement. That is: Did you mean 'print()'? # Default Did you

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Eric V. Smith
Eric V. Smith added the comment: You'll need to be careful about fully translating to python 3, though. What do you do with: print >> sys.stderr, "message" or: print "message", ? -- nosy: +eric.smith ___ Python tracker

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Sanyam Khurana
Sanyam Khurana added the comment: Hi Nick, Can I work on this issue? -- nosy: +CuriousLearner ___ Python tracker ___ ___ Python-bugs-

[issue30597] Show expected input in custom "print" error message

2017-06-08 Thread Nick Coghlan
New submission from Nick Coghlan: Back when we added the custom error message for missing parentheses in print calls, I also pre-seeded an explanation of the error on Stack Overflow: https://stackoverflow.com/questions/25445439/what-does-syntaxerror-missing-parentheses-in-call-to-print-mean-in-