[Python-ideas] Support Unicode code point notation

MRAB python at mrabarnett.plus.com
Sat Jul 27 19:06:08 CEST 2013


On 27/07/2013 17:46, Stephen J. Turnbull wrote:
> Steven D'Aprano writes:
>
>   > I propose that Python strings support this as the preferred escape notation for Unicode code points:
>   >
>   > '\U+03C0'
>   > => 'π'
>
> -1.  Because:
>
>   > The existing \U and \u variants must be kept for backwards
>   > compatibility, but should be (mildly) discouraged in new code.
>
> OTOH, supporting "\N{U+03C0}" seems harmless, if not particularly useful,
> to me.  However, I don't find it hard to imagine that some people
> would use it in preference to the \U and \u escpes, despite being
> somewhat verbose.
>
I think the point of "\N{U+03C0}" is that it lets you name all of the
codepoints, even those that are as yet unnamed. :-)


More information about the Python-ideas mailing list