This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mdk
Recipients Anna Koroliuk, docs@python, ethan.furman, ezio.melotti, martin.panter, mdk, serhiy.storchaka, terry.reedy, vstinner
Date 2016-12-01.09:28:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480584529.39.0.0628025544175.issue26483@psf.upfronthosting.co.za>
In-reply-to
Content
“digits which do not form decimal radix forms”

> “forming a form” seems a long way of saying very little. The difference seems a bit vague

> I gather that digits not in the Unicode “decimal digit” category are often (always?) still decimal digits

I expected them not to, but they often are representative of a base 10 value:

>>> import sys
>>> import unicodedata
>>> chars = ''.join(map(chr, range(sys.maxunicode+1)))
>>> decimals = ''.join(filter(str.isdecimal, chars))
>>> digits = ''.join(filter(str.isdigit, chars))
>>> non_decimal_digits = set(digits) - set(decimals)
>>> from collections import Counter
>>> Counter([unicodedata.digit(char) for char in non_decimal_digits])
Counter({1: 15, 2: 14, 3: 14, 4: 14, 5: 13, 6: 13, 7: 13, 8: 13, 9: 13, 0: 6})

But, note that there's one more in the range [1,4], it's the [Kharosthi](https://en.wikipedia.org/wiki/Kharosthi) numbers, they do not use base 10 but a notation reminiscent of Roman numerals.

So here, clearly, all digits are not an notation for a base 10 value.
 
> but primarily used for a symbolic or typographical meaning more than in a plain number, e.g. superscripts, subscripts and other fonts, added circles and other decorations.

Which also can't be used to form a base 10 number.

So here is another proposition for isdecimal, probably more human friendly:

    Return true if all characters in the string are decimal
    characters and there is at least one character, false
    otherwise. Decimal characters are those that can be used to form
    numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT
    ZERO. Formally a decimal character is a character in the Unicode
    General Category "Nd".

And here is another proposition for isdigit, probably friendlier too:

    Return true if all characters in the string are digits and there is at least one
    character, false otherwise.  Digits include decimal characters and digits that need
    special handling, such as the compatibility superscript digits.
    This covers digits which cannot be used to form numbers in base 10, like the Kharosthi numbers.
    Formally, a digit is a character that has the property value
    Numeric_Type=Digit or Numeric_Type=Decimal.
History
Date User Action Args
2016-12-01 09:28:49mdksetrecipients: + mdk, terry.reedy, vstinner, ezio.melotti, docs@python, ethan.furman, martin.panter, serhiy.storchaka, Anna Koroliuk
2016-12-01 09:28:49mdksetmessageid: <1480584529.39.0.0628025544175.issue26483@psf.upfronthosting.co.za>
2016-12-01 09:28:49mdklinkissue26483 messages
2016-12-01 09:28:48mdkcreate