[Python-ideas] Input characters in strings by decimals (Was: Proposal for default character representation)
Chris Angelico
rosuav at gmail.com
Thu Dec 8 11:52:23 EST 2016
On Fri, Dec 9, 2016 at 3:06 AM, Mikhail V <mikhailwas at gmail.com> wrote:
> Results for "unicode table" in google:
>
> Top Result # 2:
> www.utf8-chartable.de/
>
> Top Result # 4:
> http://www.tamasoft.co.jp/en/general-info/index.html
Both of those show hex first, and decimal as an additional feature.
> Some sites does not provide any code conversion, but everybody can
> do it easily, also I don't have problems generating a table programmatically.
> And I hope it is clear why most people stick to hex (I never argued that BTW),
> but it is mostly historical, nothing to do with "logical". There is
> just tendency
> to repeat what majority does and not always it is good, this case
> would be an example.
In the first place, many people have pointed out to you that Unicode
*is* laid out best in hexadecimal. (Another example: umop apisdn ?!
are ¿¡, which are ?! with one high bit set.) But in the second place,
"what the majority does" actually IS a strong argument. It's called
consistency. Why is "\r" a carriage return? Wouldn't it be more
logical to use "\c" for that? Except that EVERYONE uses \r for it. And
the one time in my life that I found "\123" to mean "{" rather than
"S", it was a great frustration for me:
http://rosuav.blogspot.com.au/2012/12/i-want-my-octal.html
And that's the choice between decimal and *octal*, which is a far less
well known base than hex is. I would still prefer octal, because it's
consistent.
So because of consistency, Python needs to support "\u0303" to mean
COMBINING TILDE, and any competing notation has to be in addition to
that. Can you justify the confusion of sometimes working with hex and
sometimes decimal? It's a pretty high bar to attain. You have to show
that decimal isn't just marginally better than hex; you have to show
that there are situations where the value of decimal character
literals is so great that it's worth forcing everyone to learn two
systems. And I'm not convinced you've even hit the first point.
ChrisA
More information about the Python-ideas
mailing list