[Python-ideas] Input characters in strings by decimals (Was: Proposal for default character representation)
Paul Moore
p.f.moore at gmail.com
Thu Dec 8 04:00:55 EST 2016
On 7 December 2016 at 23:52, Mikhail V <mikhailwas at gmail.com> 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)"
>
> =========
>
> This is more compact and seems not very contradictive with
> current Python escape characters in string literals.
> So backslash is a start of some escaping in most cases.
>
> For me most important is that in such way I would avoid
> any presence of hex numbers in strings, which I find very good
> for readability and for me it is very convinient since I use decimals
> for processing everywhere (and encourage everyone to do so).
>
> So this is my proposal, any comments on this are appreciated.
-1. We already have plenty of ways to specify characters in
strings[1], we don't need another.
If readability is what matters to you, and you (unlike many others)
consider hex to be unreadable, use the \N{...} form.
Paul
[1] Including (ab)using f-strings to hide the use of chr().
More information about the Python-ideas
mailing list