On Mon, Jun 18, 2012 at 3:59 PM, "Martin v. Löwis" <martin@v.loewis.de> wrote:
">

(original) (raw)

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@gmail.com> wrote:

On Mon, Jun 18, 2012 at 3:59 PM, "Martin v. Löwis" <martin@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@gmail.com | Brisbane, Australia



--
--Guido van Rossum (python.org/\~guido)