[issue12568] Add functions to get the width in columns of a character

Martin v. Löwis report at bugs.python.org
Sun Mar 11 04:26:12 CET 2012

Martin v. Löwis <martin at v.loewis.de> added the comment:

poq: I still remain opposed to exposing wcswidth, since it is just as incorrect as any of the other solutions that people have circulated. I could agree to it if it was called "wcswidth", making it clear that it does whatever the C library does, with whatever semantics the C library wants to give to it (and an availability that depends on whether the C library supports it or not). 

That would probably cover the nurses use cases, except that it is not only incorrect with respect to Unicode, but also incorrect with respect to what the terminal may be doing. I guess users would use it anyway.

For Python's internal use, I could accept using the sombok algorithm. I wouldn't expose it, since it again would trick people into believing that it was correct in some sense. Perhaps calling it sombok_width might allow for exposing it.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list