diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2004-08-04 07:38:35 +0000 |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2004-08-04 07:38:35 +0000 |
commit | e9ddfbb41207328d5c89061067f3431e00711fda (patch) | |
tree | 54093161fe6808de7d6fcc3304eb32241231f010 /Objects/unicodectype.c | |
parent | b5047fd01948ab108edcc1b3c2c901d915814cfd (diff) | |
download | cpython-git-e9ddfbb41207328d5c89061067f3431e00711fda.tar.gz |
SF #989185: Drop unicode.iswide() and unicode.width() and add
unicodedata.east_asian_width(). You can still implement your own
simple width() function using it like this:
def width(u):
w = 0
for c in unicodedata.normalize('NFC', u):
cwidth = unicodedata.east_asian_width(c)
if cwidth in ('W', 'F'): w += 2
else: w += 1
return w
Diffstat (limited to 'Objects/unicodectype.c')
-rw-r--r-- | Objects/unicodectype.c | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c index d770bdbf65..083fbe19f5 100644 --- a/Objects/unicodectype.c +++ b/Objects/unicodectype.c @@ -19,7 +19,6 @@ #define SPACE_MASK 0x20 #define TITLE_MASK 0x40 #define UPPER_MASK 0x80 -#define WIDE_MASK 0x100 typedef struct { const Py_UNICODE upper; @@ -323,15 +322,6 @@ int _PyUnicode_IsNumeric(Py_UNICODE ch) return 1; } -/* Returns 1 for Unicode characters having Full or Wide width, 0 otherwise */ - -int _PyUnicode_IsWide(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - - return (ctype->flags & WIDE_MASK) != 0; -} - #ifndef WANT_WCTYPE_FUNCTIONS /* Returns 1 for Unicode characters having the bidirectional type |