[Python-3000] raw strings and \u

Benjamin Peterson musiccomposition at gmail.com
Sat Apr 5 16:07:53 CEST 2008


On Sat, Apr 5, 2008 at 7:25 AM, Amaury Forgeot d'Arc <amauryfa at gmail.com>
wrote:

> Martin v. Löwis wrote:
> > > I just checked in r62163 with this change:
> >  > -            rc = os.system(r"ml64 -c -Foms\uptable.obj
> ms\uptable.asm")
> >  > +            rc = os.system("ml64 -c -Foms\\uptable.obj
> ms\\uptable.asm")
> >  >
> >  > What should happen with raw unicode strings that contain a \u?  The
> >  > old code above was generating:
> >  >   SyntaxError: (unicode error) truncated \uXXXX
> >  >
> >  > Is that correct?  Or should the \u be translated literally?
> >
> >  The intention is that the file ms\uptable.asm is compiled to
> >  ms\uptable.obj. So the change is correct.  (not sure what
> >  alternatives you might have considered)
>
> I use raw strings when there are backslashes in the text, and I still
> want it to be readable::
>
>    r"C:\Documents and Settings\User"
>
> But this is now invalid!
> This kills the usefulness of it IMO.

I agree. I think we have three choices:
1. Don't allow Unicode escapes in raw mode.
2. Introduce a new mode which has unicode escapes and raw mode.
3. Deal with it.

I don't like any of them...

>
>
> --
> Amaury Forgeot d'Arc
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/musiccomposition%40gmail.com
>



-- 
Cheers,
Benjamin Peterson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20080405/a1d0d9cb/attachment.htm 


More information about the Python-3000 mailing list