[issue25433] whitespace in strip()/lstrip()/rstrip()
Dimitri Papadopoulos Orfanos
report at bugs.python.org
Fri Mar 30 02:39:52 EDT 2018
Dimitri Papadopoulos Orfanos <dimitri.papadopoulos at gmail.com> added the comment:
I agree on avoiding a link to str.isspace() and defining "whitespace" instead.
However please note there are many de facto definitions of "whitespace". All of them must be documented - or at least the conceptual classes of "whitespace" and clarify which class each of the following belongs to:
* Unicode whitespaces are by very far the most common: str.isspace(), strip()/lstrip()/rstrip(), Py_UNICODE_ISSPACE.
* Py_ISSPACE targets byte/bytearray but is never used!
* bytearray.strip() does not use Py_ISSPACE but a hardcoded list of ASCII whitespaces instead.
* finally string.whitespace is probably equivalent to the list used by bytearray.strip().
Beyond the docs, I think Python 3 should rationalize bytearray.strip() / Py_ISSPACE / string.whitespace, probably having bytearray.strip() rely on Py_ISSPACE, and Py_ISSPACE rely on string.whitespace unless string.whitespace is obsoleted.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue25433>
_______________________________________
More information about the Python-bugs-list
mailing list