[Python-Dev] Raw string syntax inconsistency

Guido van Rossum guido at python.org
Mon Jun 18 17:12:53 CEST 2012


Ok, banning ru"..." and ur"..." altogether is fine too (assuming it's fine
with the originators of the PEP).

On Sun, Jun 17, 2012 at 11:31 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> On Mon, Jun 18, 2012 at 3:59 PM, "Martin v. Löwis" <martin at v.loewis.de>
> wrote:
> > On 17.06.2012 22:41, Guido van Rossum wrote:
> >> Would it make sense to detect and reject these in 3.3 if the 2.7 syntax
> >> is used?
> >
> > Maybe we are talking about different things: The (new) proposal is that
> > the ur prefix in 3.3 is a syntax error (again, as it was before PEP
> > 414). So, yes: the raw unicode literals will be rejected (not by
> > explicitly detecting them, though).
>
> I think GvR was replying to my email where I was briefly reconsidering
> the idea of keeping them around (because the unicode_literals future
> import already suffers from this problem of literals that don't mean
> the same things in 2.x and in 3.x). However, that was flawed reasoning
> on my part - simply banning them altogether in 3.x is the simplest
> option to ensure this particular error doesn't pass silently,
> especially since there are alternate forward compatible ways to write
> them, such as:
>
> Python 2.7.3 (default, May 29 2012, 14:54:22)
> >>> from __future__ import unicode_literals
> >>> print(u"\u03b3" r"\n")
> γ\n
> >>> print(u"\u03b3\\n")
> γ\n
>
> Python 3.3.0a4 (default:f1dd70bfb4c5, May 31 2012, 09:47:51)
> >>> print(u"\u03b3" r"\n")
> γ\n
> >>> print(u"\u03b3\\n")
> γ\n
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120618/51a175b4/attachment-0001.html>


More information about the Python-Dev mailing list