In #424 I fixed some issues with formatnum and introduced localization configuration, but I couldn't figure out a simple way (with an authorative Python-friendly source) to do alternative digit localization correctly.
formatnum is a parserfn that does basically two things:
- takes a basic "English programming" formatted number string like
123456789.123 and turns it into a formatted string (123,456,789.123 in English, 123.456.789,123 in French and 12,34,56,789.123 in Hindi, if we used Arabic numerals because alternative digits aren't implemented yet).
- takes a previously formatted string and returns the "English programming" formatted number string. Basically, it removes the thousands separators and should (if it was implemented) turns alternative digits back to Arabic numerals.
There's some information about alternative digits that should be available in standard library Python... Except it's bugged: python/cpython#124969
Additionally, the data accessible with locale.ALT_DIGITS is... just a list of actual "numbers"; a list (or a null-separated array of strings in C, which is where the bug lies with Python) of strings that correspond exactly to "0", "1", "2"... and "15", "16" etc. up to "99".
It doesn't tell you how to do the conversion, it's just a list of the first hundred positive integers.
This will be on the backburner until a later version of Python, at the very least.
In #424 I fixed some issues with
formatnumand introduced localization configuration, but I couldn't figure out a simple way (with an authorative Python-friendly source) to do alternative digit localization correctly.formatnumis a parserfn that does basically two things:123456789.123and turns it into a formatted string (123,456,789.123in English,123.456.789,123in French and12,34,56,789.123in Hindi, if we used Arabic numerals because alternative digits aren't implemented yet).There's some information about alternative digits that should be available in standard library Python... Except it's bugged: python/cpython#124969
Additionally, the data accessible with
locale.ALT_DIGITSis... just a list of actual "numbers"; a list (or a null-separated array of strings in C, which is where the bug lies with Python) of strings that correspond exactly to "0", "1", "2"... and "15", "16" etc. up to "99".It doesn't tell you how to do the conversion, it's just a list of the first hundred positive integers.
This will be on the backburner until a later version of Python, at the very least.