python - Difference between isdecimal and isdigit -


the python 3 documentation isdigit says

return true if characters in string digits , there @ least 1 character, false otherwise. digits include decimal characters , digits need special handling, such compatibility superscript digits. formally, digit character has property value numeric_type=digit or numeric_type=decimal.

so sounds isdigit should superset of isdecimal. docs isdecimal say

return true if characters in string decimal characters , there @ least 1 character, false otherwise. decimal characters general category “nd”. this category includes digit characters, , characters can used form decimal-radix numbers, e.g. u+0660, arabic-indic digit zero.

that sounds isdecimal should superset of isdigit.

how these methods related? 1 of them match strict superset of other matches? numeric_type property have nd category? (and contradictory documentation documentation bug?)

as found out, correspondence between string predicates checking numeric value , unicode character properties following:

isdecimal: nd, isdigit:   no, nd, isnumeric: no, nd, nl, isalnum:   no, nd, nl, lu, lt, lo, lm, ll, 

e.g., ᛰ (runic belgthor symbol, u+16f0) belongs nl, therefore:

'ᛰ'.isdecimal() # false 'ᛰ'.isdigit()   # false 'ᛰ'.isnumeric() # true 'ᛰ'.isalnum()   # true 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -