[Python-Dev] Emit SyntaxWarning on unrecognized backslash escapes?
Ethan Furman
ethan at stoneleaf.us
Tue Feb 24 20:07:36 CET 2015
On 02/24/2015 10:49 AM, Guido van Rossum wrote:
> On Tue, Feb 24, 2015 at 10:47 AM, Ethan Furman wrote:
>>
>> I can attest from my impoverished Windows programming days that looking at
>>
>> --> os.listdir('c:\temp')
>> SomeErrorMessage about syntax 'c:\temp'
>>
>> is not very helpful. There is zero visual indication that the \ and the t
>> are one character, not two. Changing that error message to:
>>
>> SomeErrorMessage about syntax 'c:[\t]emp'
>>
>> or
>>
>> SomeErrorMessage about syntax 'c:\x07emp'
>>
>> or something that shouts out, "hey! one character in this location!" would be a good thing.
>
> I like the \x07 solution.
So final question is do we take the easy road and change the repr for str to always use hex or unicode escapes instead
of simple backslash-escapes (and then run for our lives), or do we just hunt down and change the appropriate error
messages for files (and possibly re) ?
--
~Ethan~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150224/4132710a/attachment-0001.sig>
More information about the Python-Dev
mailing list