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

Random832 random832 at fastmail.com
Thu Dec 8 12:29:23 EST 2016


On Thu, Dec 8, 2016, at 11:06, Mikhail V wrote:
> 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".

The problem is that there's a logic associated with how the character
sets are designed.

The character table works a lot better with rows of 16 than with rows of
10 or 20. In many blocks you get the uppercase letters lined up above
the lowercase letters, for example. And if your rows are 16 (or 32,
though that doesn't work as well for unicode because e.g. the Cyrillic
basic set А-Я/а-я starts from 0x410), then your row and column labels
work better in hex because you've lined up 0x40 above 0x50 and 0x60,
which share the last digit, unlike 64/80/96, and the whole row (or half
the row for 32) shares all but the last digit.

And those values are also only off by one bit, too. Even if we were to
arrange the characters themselves in rows of 10/20, so you've got 30 or
40 characters in an "alphabet row", then you'd have to add or subtract
to change the case, whereas many early character sets were designed to
be able to do this by changing a bit, for bit-paired keyboards.

What looks better?

Hex:
АБВГДЕЖЗИЙКЛМНОП
РСТУФХЦЧШЩЪЫЬЭЮЯ
абвгдежзийклмноп
рстуфхцчшщъыьэюя

Decimal:
АБВГДЕЖЗИЙКЛМНОПРСТУ
ФХЦЧШЩЪЫЬЭЮЯабвгдежз
ийклмнопрстуфхцчшщъы
ьэюя

And it's only luck that the uppercase Russian alphabet starts at the
beginning of a line. The ASCII section with the English alphabet looks
like this in decimal:
<=>?@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_`abc
defghijklmnopqrstuvw
xyz

compared to this in hex:
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
`abcdefghijklmno
pqrstuvwxyz


> There is just tendency
> to repeat what majority does and not always it is good, this case
> would be an example.


More information about the Python-ideas mailing list