Re: Unrecognized backslash escapes in string literals

2015-02-23 Thread Serhiy Storchaka
On 23.02.15 04:55, Chris Angelico wrote: I agree, the fault is primarily with Windows. But I've seen similar issues when people use /-\| for box drawing and framing and such; Windows paths are by far the most common case of this, but not the sole. There is also issues with regular expressions.

Re: Unrecognized backslash escapes in string literals

2015-02-23 Thread Peter Otten
Ben Finney wrote: Chris Angelico ros...@gmail.com writes: That said, though, there's probably a lot of code out there that depends on backslashes being non-special, so it's quite probably something that can't be changed. But it'd be nice to be able to turn on a warning for it. If you're

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Dave Angel
On 02/22/2015 09:29 PM, Chris Angelico wrote: In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. This can mask bugs, especially when Windows path names are used: 'C:\sqlite\Beginner.db' 'C:\\sqlite\\Beginner.db'

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Dave Angel
On 02/22/2015 09:41 PM, Ben Finney wrote: Chris Angelico ros...@gmail.com writes: In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. Right. Text strings literals are documented to work that way

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 1:41 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Right. Text strings literals are documented to work that way URL:https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str, which refers the reader to the language reference

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. Right. Text strings literals are documented to work that way

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 1:41 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Chris Angelico ros...@gmail.com writes: Why is it that Python interprets them this way, and doesn't even give a warning? Because the interpretation of those literals is unambiguous and correct. And it also implies

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: That said, though, there's probably a lot of code out there that depends on backslashes being non-special, so it's quite probably something that can't be changed. But it'd be nice to be able to turn on a warning for it. If you're motivated to see such

Unrecognized backslash escapes in string literals

2015-02-22 Thread Chris Angelico
In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. This can mask bugs, especially when Windows path names are used: 'C:\sqlite\Beginner.db' 'C:\\sqlite\\Beginner.db' 'c:\sqlite\beginner.db' 'c:\\sqlite\x08eginner.db'

Re: Backslash Escapes

2011-12-26 Thread Lie Ryan
On 12/26/2011 12:04 PM, Felipe O wrote: Hi all, Whenever I take any input (raw_input, of course!) or I read from a file, etc., any backslashes get escaped automatically. Python never escapes backslashes when reading from raw_input or files. Python only ever escapes backslashes when displaying

Backslash Escapes

2011-12-25 Thread Felipe O
obscure backslash escapes or other tricks I should be aware of? I guess the alternative is to make a dictionary of all the escapes I want to support, but that sounds tedious and error-prone. Thanks, Felipe -- http://mail.python.org/mailman/listinfo/python-list

Re: Backslash Escapes

2011-12-25 Thread MRAB
from an unfriendly source. + Are there any obscure backslash escapes or other tricks I should be aware of? I guess the alternative is to make a dictionary of all the escapes I want to support, but that sounds tedious and error-prone. Try input_string.decode(string-escape) if input_string

Re: Backslash Escapes

2011-12-25 Thread Devin Jeanpierre
in parts) I'm not entirely convinced that it's safe on two accounts. + Is that eval statement safe? The input could be coming from an unfriendly source. + Are there any obscure backslash escapes or other tricks I should be aware of? I guess the alternative is to make a dictionary of all

Re: Backslash Escapes

2011-12-25 Thread Chris Angelico
string... I guess the alternative is to make a dictionary of all the escapes I want to support, but that sounds tedious and error-prone. The question really is: Are you looking to support some backslash escapes, or are you looking to imitate Python? If the former, I recommend making a specific list

[issue1720390] Remove backslash escapes from tokenize.c.

2007-11-15 Thread Ron Adam
Ron Adam added the comment: It looks like the disabling of \u and \U in raw strings is done. Does tokenize.py need to be fixed, to match? While working on this I was able to clean up the string parsing parts of tokenize.c, and have a separate patch with just that. And an updated patch with

[issue1720390] Remove backslash escapes from tokenize.c.

2007-11-15 Thread Ron Adam
Changes by Ron Adam: Added file: http://bugs.python.org/file8763/no_raw_escapes_patch.diff _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1720390 _ ___ Python-bugs-list

[issue1720390] Remove backslash escapes from tokenize.c.

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: I don't think tokenizer.py needs to be changed -- it never interpreted backslashes in string literals anyway (not even in regular, non-raw literals). The tokenizer.c cleanup is submitted as revision 59007. I still am not warming up towards the no-raw-escapes

[issue1720390] Remove backslash escapes from tokenize.c.

2007-11-08 Thread Christian Heimes
Christian Heimes added the comment: Can you create a new patch and verify that the problem still exists? norawescape3.diff doesn't apply cleanly any more. -- nosy: +tiran _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1720390

[issue1720390] Remove backslash escapes from tokenize.c.

2007-11-08 Thread Ron Adam
Ron Adam added the comment: Yes, I will update it. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1720390 _ ___ Python-bugs-list mailing list Unsubscribe:

[issue1720390] Remove backslash escapes from tokenize.c.

2007-11-08 Thread Guido van Rossum
Guido van Rossum added the comment: FWIW, I'm +1 on the part of this patch that disables \u in raw strings. I just had a problem with a doctest that couldn't be run in verbose mode because \u was being interpreted in raw mode... But I'm still solidly -1 on allowing trailing \.

[issue1720390] Remove backslash escapes from tokenize.c.

2007-08-29 Thread Guido van Rossum
Changes by Guido van Rossum: -- versions: +Python 3.0 _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1720390 _ ___ Python-bugs-list mailing list Unsubscribe: