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 "<expr>" in the error message, rather than the 
full text of the original statement.

That is:

    Did you mean 'print(<expr>)'?                 # Default 
    Did you mean 'print(<expr>, file=<stream>)'?  # starts with '>>'
    Did you mean 'print(<expr>, end=' ')'?        # ends with ','

That's basically correct even when printing multiple arguments, so I'd avoid 
the temptation to detect commas within the line (particularly since they might 
be inside a string).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30597>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to