diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2004-08-04 07:38:35 (GMT) |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2004-08-04 07:38:35 (GMT) |
commit | e9ddfbb41207328d5c89061067f3431e00711fda (patch) | |
tree | 54093161fe6808de7d6fcc3304eb32241231f010 /Doc/lib | |
parent | b5047fd01948ab108edcc1b3c2c901d915814cfd (diff) | |
download | cpython-e9ddfbb41207328d5c89061067f3431e00711fda.zip cpython-e9ddfbb41207328d5c89061067f3431e00711fda.tar.gz cpython-e9ddfbb41207328d5c89061067f3431e00711fda.tar.bz2 |
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 'Doc/lib')
-rw-r--r-- | Doc/lib/libstdtypes.tex | 11 | ||||
-rw-r--r-- | Doc/lib/libunicodedata.tex | 7 |
2 files changed, 6 insertions, 12 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index 7d69b64..c33360d 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -664,12 +664,6 @@ there is at least one cased character, false otherwise. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{iswide}{} -Return true if all characters in the string are wide or full width and -there is at least one wide or full width character, false otherwise. -This method is supported by unicode type only. -\end{methoddesc} - \begin{methoddesc}[string]{join}{seq} Return a string which is the concatenation of the strings in the sequence \var{seq}. The separator between elements is the string @@ -810,11 +804,6 @@ Return a copy of the string converted to uppercase. For 8-bit strings, this method is locale-dependent. \end{methoddesc} -\begin{methoddesc}[string]{width}{} -Return length of fixed-width representation of the string. This method -is supported by unicode type only. -\end{methoddesc} - \begin{methoddesc}[string]{zfill}{width} Return the numeric string left filled with zeros in a string of length \var{width}. The original string is returned if diff --git a/Doc/lib/libunicodedata.tex b/Doc/lib/libunicodedata.tex index a6d9d43..2922913 100644 --- a/Doc/lib/libunicodedata.tex +++ b/Doc/lib/libunicodedata.tex @@ -71,6 +71,11 @@ defines the following functions: class is defined. \end{funcdesc} +\begin{funcdesc}{east_asian_width}{unichr} + Returns the east asian width of assigned to the Unicode character + \var{unichr} as string. +\end{funcdesc} + \begin{funcdesc}{mirrored}{unichr} Returns the mirrored property of assigned to the Unicode character \var{unichr} as integer. Returns \code{1} if the character has been @@ -123,4 +128,4 @@ In addition, the module exposes the following constant: The version of the Unicode database used in this module. \versionadded{2.3} -\end{datadesc}
\ No newline at end of file +\end{datadesc} |