[Python-ideas] Smart/Curly Quote Marks and cPython

Terry Reedy tjreedy at udel.edu
Sat Oct 22 22:51:02 EDT 2016


On 10/22/2016 3:16 AM, Steven D'Aprano wrote:

> I would be happy to see improved error messages for smart quotes:

> py> s = ‘abcd’
>   File "<stdin>", line 1
>     s = ‘abcd’
>              ^
> SyntaxError: invalid character in identifier

The above *is* the improved (and regressed) 3.6 version ;-)
In 3.5.2 (on Windows):

 >>> s = ‘abcd’
   File "<stdin>", line 1
     s = `abcd'
         ^
SyntaxError: invalid syntax

(Mangling of the echoed code line is Windows specific.) The improvement 
is the more specific error message.  The regression is the placement of 
the caret at the end instead of under the initial '‘'.  To verify that 
Python is not actually pointing at '’', remove it.

 >>>  s = ‘abcd
   File "<stdin>", line 1
     s = ‘abcd
             ^
SyntaxError: invalid character in identifier

(recent 3.6 changes in encodings used on Windows removes code mangling 
in this echoed line.)

> (especially in IDLE),

What do you have in mind?  Patches would be considered.  I will continue 
this in response to Nick's post about 9 hours ago.

-- 
Terry Jan Reedy





More information about the Python-ideas mailing list