Author gregory.p.smith
Recipients gregory.p.smith
Date 2017-08-08.00:50:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502153449.52.0.763252325075.issue31136@psf.upfronthosting.co.za>
In-reply-to
Content
A raw string literal cannot end in a backslash.  There is no friendly way to write a string that ends in a backslash character.

In particular I want to put the following into a Python string: \\?\

'\\\\?\\' works but is escaping hell so I wanted to suggest to the author to use r'\\?\' but that leads to:
SyntaxError: EOL while scanning string literal

Tested in a random 3.7.0a0 build as well as older 2.7 and 3.x stable versions.

r'\' is the easiest way to reproduce this.  (which could be written using the same number of bytes as '\\'... the use case above where a string containing a lot of \s that also ends in a \ is where it matters more from a code beauty point of view)

Can we update the parser to allow this?
History
Date User Action Args
2017-08-08 00:50:49gregory.p.smithsetrecipients: + gregory.p.smith
2017-08-08 00:50:49gregory.p.smithsetmessageid: <1502153449.52.0.763252325075.issue31136@psf.upfronthosting.co.za>
2017-08-08 00:50:49gregory.p.smithlinkissue31136 messages
2017-08-08 00:50:48gregory.p.smithcreate