This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author v+python
Recipients QuantumTim, facundobatista, georg.brandl, gwideman, r.david.murray, v+python
Date 2011-03-12.02:28:36
SpamBayes Score 2.4424907e-15
Marked as misclassified No
Message-id <1299896917.65.0.24414420964.issue1271@psf.upfronthosting.co.za>
In-reply-to
Content
@Graham: seems like the two primary gotchas are trailing \ and \" \' not removing the \.  The one that tripped me up the most was the trailing \, but I did get hit with \" once.  Probably if Python had been my first programming language that used \ escapes, it wouldn't be such a problem, but since it never will be, and because I'm forced to use the others from time to time, still, learning yet a different form of "not-quite raw" string just isn't worth my time and debug efforts.  When I first saw it, it sounded more useful than doubling the \s like I do elsewhere, but after repeated trip-ups with trailing \, I decided it wasn't for me.

@R David: Interesting description of the parsing/escaping.  Sounds like that makes for a cheap parser, fewer cases to handle.  But there is little that is hard about escape-free or exact string parsing: just look for the trailing " ' """ or ''' that matches the one at the beginning.  The only thing difficult is if you want to escape the quote, but with the rich set of quotes available, it is extremely unlikely that you can't find one that you can use, except perhaps if you are writing a parser for parsing Python strings, in which case, the regular expression that matches any leading quote could be expressed as:

'("|"""|' "'|''')"

Granted that isn't the clearest syntax in the world, but it is also uncommon, and can be assigned to a nicely named variable such as matchLeadingQuotationRE in one place, and used wherever needed.

Regarding the use of / rather that \ that is true if you are passing file names to Windows APIs, but not true if you are passing them to other programs that use / as option syntax and \ as path separator (most Windows command line utilities).
History
Date User Action Args
2011-03-12 02:28:37v+pythonsetrecipients: + v+python, georg.brandl, facundobatista, QuantumTim, r.david.murray, gwideman
2011-03-12 02:28:37v+pythonsetmessageid: <1299896917.65.0.24414420964.issue1271@psf.upfronthosting.co.za>
2011-03-12 02:28:37v+pythonlinkissue1271 messages
2011-03-12 02:28:36v+pythoncreate