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

2022-05-30 Thread Steven D'Aprano
Thank you to everyone who responded, it is now clear to me that this genuinely is a feature, not a bug or limitation of the parser or lexer. And that there is code relying on that behaviour, including in the stdlib, so we shouldn't change it even if we could. -- Steve

[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