Ezio Melotti <ezio.melo...@gmail.com> added the comment:

> So I guess this brings me back to my original issue. I'm not looking 
> for particularly advanced stripping. I just want to remove all 
> whitespace and other non-printing characters.

.strip only strips whitespace.  Stripping non-printing characters and 
additional 'whitespace' is something that is too specific for a builtin method, 
especially because people might disagree on the characters that are considered 
whitespace and non-printing.

> Thus strip and isspace are now unusable methods in Python for common
> use cases. This seems unfortunate.

I believe they work fine for the common case -- in fact these methods have been 
around for years and no one complained.
Also Unicode has a number of more or less space-like characters that are not 
whitespace and whitespace chars that don't look like whitespace.
If one needs to strip a different set of (whitespace) chars, it's always 
possible to pass it to .strip or to define a new function like
def mystrip(s):
    return s.strip().strip(u'\u200B\ufeff')

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13391>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to