[Python-ideas] Input characters in strings by decimals (Was: Proposal for default character representation)

Mikhail V mikhailwas at gmail.com
Wed Dec 7 21:15:06 EST 2016


On 8 December 2016 at 01:52, MRAB <python at mrabarnett.plus.com> wrote:
> On 2016-12-07 23:52, Mikhail V wrote:
...
>> =========
>> Proposal: I would want to have a possibility to input it *by decimals*:
>>
>> s = "first cyrillic letters: \{1040}\{1041}\{1042}"
>> or:
>> s = "first cyrillic letters: \(1040)\(1041)\(1042)"
>>
>> =========
>>

> It's usually the case that escapes are \ followed by an ASCII-range letter
> or digit; \ followed by anything else makes it a literal, even if it's a
> metacharacter, e.g. " terminates a string that starts with ", but \" is a
> literal ", so I don't like \{...}.
>
> Perl doesn't have \u... or \U..., it has \x{...} instead, and Python already
> has \N{...}, so:
>
> s = "first cyrillic letters: \d{1040}\d{1041}\d{1042}"
>
> might be better,

I like this and I agree this corresponds the current style better .

> but I'm still -1 because hex is usual when referring to
> Unicode codepoints.

:-(


More information about the Python-ideas mailing list