You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the Russian character u'ч' and u'ё' as well as a bunch of others is
not recognized by isalpha as a alphabetic character, which it is a
matter of fact.
This applies to both capital and regular versions of the letters.
Are you sure that you've used the right source code encoding for writing
these characters ?
Note that the Unicode .isalpha() method relies entirely on what the
Unicode database provides as code point information. If a character is
marked as not being alphanumeric (ie. is not in one of the categories
'Ll', 'Lu', 'Lt', 'Lo' or 'Lm'), it will return False.
With Python 2.7 trunk:
>>> print(', '.join('%s:%s'% (c, c.isalpha()) for c inu'абвгдеч'))
а:True, б:True, в:True, г:True, д:True, е:True, ч:True
With Python 2.5.1:
>>> print(', '.join('%s:%s'% (c, c.isalpha()) for c inu'абвгдеч'))
а:True, б:True, в:True, г:True, д:True, е:True, ч:True
With Python 3.0 trunk:
>>> print(', '.join('%s:%s'% (c, c.isalpha()) for c in'абвгдеч'))
а:True, б:True, в:True, г:True, д:True, е:True, ч:True
Are you sure that you really typed the character "ч"? Can you retry
using unichr(0x447).isalpha()?
Test with Python3:
>>> print(' - '.join((r"\u%04x"% x) for x inrange(0x400, 0x4ff+1) if
not chr(x).isalpha()))
\u0482 - \u0483 - \u0484 - \u0485 - \u0486 - \u0487 - \u0488 - \u0489
Which means that Python thinks that all unicode character in range
U+0400..U+04ff are letters except the range U+0482..U+0489 (thousands
sign ҂ to million sign ҉).
ZooKeeper commented on Nov 13, 2008
ZooKeepermannequin
MannequinAuthor
More actions
I'll investigate it in further shortly, but for now replicating the test.
print u'\u0451'
¸
print u'\u0427'
×
Activity
ZooKeeper commentedon Nov 13, 2008
This may be a little tricky to recreate but here it is:
So the Russian character u'ч' and u'ё' as well as a bunch of others is
not recognized by isalpha as a alphabetic character, which it is a
matter of fact.
This applies to both capital and regular versions of the letters.
http://en.wikipedia.org/wiki/%D0%81
http://en.wikipedia.org/wiki/Che_(Cyrillic)
Using: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win32
malemburg commentedon Nov 13, 2008
Are you sure that you've used the right source code encoding for writing
these characters ?
Note that the Unicode .isalpha() method relies entirely on what the
Unicode database provides as code point information. If a character is
marked as not being alphanumeric (ie. is not in one of the categories
'Ll', 'Lu', 'Lt', 'Lo' or 'Lm'), it will return False.
malemburg commentedon Nov 13, 2008
FWIW: I get the following in Python 2.5:
malemburg commentedon Nov 13, 2008
... and for the other character:
Looks fine.
vstinner commentedon Nov 13, 2008
Results on Linux:
Are you sure that you really typed the character "ч"? Can you retry
using unichr(0x447).isalpha()?
Which means that Python thinks that all unicode character in range
U+0400..U+04ff are letters except the range U+0482..U+0489 (thousands
sign ҂ to million sign ҉).
ZooKeeper commentedon Nov 13, 2008
I'll investigate it in further shortly, but for now replicating the test.
print u'\u0451'
¸
print u'\u0427'
×
Something must be going on here. Running Win XP.
vstinner commentedon Nov 13, 2008
@ZooKeeper: Try Python 2.6, I guess that your bug is already fixed.