Skip to content

Commit 0ba0278

Browse files
authored
spellfix about n argument (#108)
* spellfix about ``n`` argument nobody should be using this argument, anyway! Its a holdover from the C POSIX function signature * Suggest not to use the ``n`` argument
1 parent 076164e commit 0ba0278

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

wcwidth/wcwidth.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ def wcswidth(pwcs, n=None, unicode_version='auto'):
162162
Given a unicode string, return its printable length on a terminal.
163163
164164
:param str pwcs: Measure width of given unicode string.
165-
:param int n: When ``n`` is None (default), return the length of the
166-
entire string, otherwise width the first ``n`` characters specified.
165+
:param int n: When ``n`` is None (default), return the length of the entire
166+
string, otherwise only the first ``n`` characters are measured. This
167+
argument exists only for compatibility with the C POSIX function
168+
signature. It is suggested instead to use python's string slicing
169+
capability, ``wcswidth(pwcs[:n])``
167170
:param str unicode_version: An explicit definition of the unicode version
168171
level to use for determination, may be ``auto`` (default), which uses
169172
the Environment Variable, ``UNICODE_VERSION`` if defined, or the latest

0 commit comments

Comments
 (0)