[Python-Dev] Re: [OT] Re: Raw strings ending with a backslash

2022-05-28 Thread Jonathan Goble
Trying again after I was mysteriously moderated. Thanks Ethan for fixing that. On Sat, May 28, 2022 at 6:59 PM Jonathan Goble wrote: > On Sat, May 28, 2022, 4:25 PM Gregory P. Smith wrote: > >> >> On Sat, May 28, 2022 at 12:55 PM Guido van Rossum >> wrote: >> >>> >>> On Sat, May 28, 2022 at

[Python-Dev] Re: [OT] Re: Raw strings ending with a backslash

2022-05-28 Thread Gregory P. Smith
On Sat, May 28, 2022 at 12:55 PM Guido van Rossum wrote: > > On Sat, May 28, 2022 at 12:11 MRAB > > Names in Python are case-sensitive, yet the string prefixes are >> case-/insensitive/. >> >> Why? > > > IIRC we copied this from C for numeric suffixes (0l and 0L are the same; > also hex digits

[Python-Dev] Re: [OT] Re: Raw strings ending with a backslash

2022-05-28 Thread Guido van Rossum
On Sat, May 28, 2022 at 12:11 MRAB Names in Python are case-sensitive, yet the string prefixes are > case-/insensitive/. > > Why? IIRC we copied this from C for numeric suffixes (0l and 0L are the same; also hex digits and presumably 0XA == 0xa) and then copied that for string prefixes without

[Python-Dev] Re: [OT] Re: Raw strings ending with a backslash

2022-05-28 Thread Chris Angelico
On Sun, 29 May 2022 at 05:05, MRAB wrote: > > On 2022-05-28 16:03, MRAB wrote: > > On 2022-05-28 13:17, Serhiy Storchaka wrote: > >> 28.05.22 14:57, Damian Shaw пише: > >>> That PR seems to make \' and \" not special in general right? > >>> > >>> I think this is a more limited proposal, to only

[Python-Dev] Re: [OT] Re: Raw strings ending with a backslash

2022-05-28 Thread MRAB
On 2022-05-28 16:03, MRAB wrote: On 2022-05-28 13:17, Serhiy Storchaka wrote: 28.05.22 14:57, Damian Shaw пише: That PR seems to make \' and \" not special in general right? I think this is a more limited proposal, to only change the behavior when \ is at the end of a string, so the only

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread Serhiy Storchaka
28.05.22 18:03, Damian Shaw пише: My understanding was that was part of the question being asked, is it possible to know what with the new PEG parser? You first need to define what is the end of a string. And I think it is not relevant to the grammar parser.

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread MRAB
On 2022-05-28 13:17, Serhiy Storchaka wrote: 28.05.22 14:57, Damian Shaw пише: That PR seems to make \' and \" not special in general right? I think this is a more limited proposal, to only change the behavior when \ is at the end of a string, so the only behavior difference would never

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread Damian Shaw
My understanding was that was part of the question being asked, is it possible to know what with the new PEG parser? On Sat, May 28, 2022 at 1:25 PM Serhiy Storchaka wrote: > 28.05.22 14:57, Damian Shaw пише: > > That PR seems to make \' and \" not special in general right? > > > > I think this

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread Eric V. Smith
On 5/28/2022 7:57 AM, Damian Shaw wrote: That PR seems to make \' and \" not special in general right? I think this is a more limited proposal, to only change the behavior when \ is at the end of a string, so the only behavior difference would never receiving the error "SyntaxError: EOL while

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread Serhiy Storchaka
28.05.22 14:57, Damian Shaw пише: That PR seems to make \' and \" not special in general right? I think this is a more limited proposal, to only change the behavior when \ is at the end of a string, so the only behavior difference would never receiving the error "SyntaxError: EOL while

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread Barney Gale
Personally I'd expect these two lines to do the same thing, whatever that thing is: path = 'C:\' path = ('C:\') Barney On Sat, 28 May 2022 at 12:59, Damian Shaw wrote: > That PR seems to make \' and \" not special in general right? > > I think this is a more limited proposal, to only change

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread Damian Shaw
That PR seems to make \' and \" not special in general right? I think this is a more limited proposal, to only change the behavior when \ is at the end of a string, so the only behavior difference would never receiving the error "SyntaxError: EOL while scanning string literal" In which case

[Python-Dev] Re: Raw strings ending with a backslash

2022-05-28 Thread Serhiy Storchaka
28.05.22 12:22, Steven D'Aprano пише: Now that we have a new parser for CPython, can we fix the old gotcha that raw strings cannot end in a backslash? Its an FAQ and has come up again on the bug tracker. https://docs.python.org/3/faq/design.html#id26

[Python-Dev] Raw strings ending with a backslash

2022-05-28 Thread Steven D'Aprano
Now that we have a new parser for CPython, can we fix the old gotcha that raw strings cannot end in a backslash? Its an FAQ and has come up again on the bug tracker. https://docs.python.org/3/faq/design.html#id26 https://github.com/python/cpython/issues/93314 -- Steve