From 0ba0278f3b586bbcc46053525d359f77f3f5b0ad Mon Sep 17 00:00:00 2001 From: Jeff Quast Date: Fri, 15 Dec 2023 03:10:35 -0500 Subject: [PATCH] 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 --- wcwidth/wcwidth.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wcwidth/wcwidth.py b/wcwidth/wcwidth.py index 59eb5c0..e924020 100644 --- a/wcwidth/wcwidth.py +++ b/wcwidth/wcwidth.py @@ -162,8 +162,11 @@ def wcswidth(pwcs, n=None, unicode_version='auto'): Given a unicode string, return its printable length on a terminal. :param str pwcs: Measure width of given unicode string. - :param int n: When ``n`` is None (default), return the length of the - entire string, otherwise width the first ``n`` characters specified. + :param int n: When ``n`` is None (default), return the length of the entire + string, otherwise only the first ``n`` characters are measured. This + argument exists only for compatibility with the C POSIX function + signature. It is suggested instead to use python's string slicing + capability, ``wcswidth(pwcs[:n])`` :param str unicode_version: An explicit definition of the unicode version level to use for determination, may be ``auto`` (default), which uses the Environment Variable, ``UNICODE_VERSION`` if defined, or the latest