On Tue, 24 Feb 2015, Ethan Furman wrote:

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) ?

Just a data point from a random programmer:

I like the \x07 solution for the error message as it draws attention to the character at issue, but I also like to see \n, \t etc. in the result of repr because it is more readable for the common cases.

Isaac Morland           CSCF Web Guru
DC 2619, x36650         WWW Software Specialist
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to