[issue22129] Please add an equivalent to QString::simplified() to Python strings

Serhiy Storchaka report at bugs.python.org
Sun Aug 3 15:39:09 CEST 2014


Serhiy Storchaka added the comment:

This is too specialized function to be included in the stdlib ar added as a method to base class.

There are simpler and faster implementations of this function:

    def simplify(s):
        return ' '.join(s.strip().split())

or

    def simplify(s):
        return re.sub(r'\s+', ' ', s.strip())

Due to they simplicity there is no need to add them in Python.

----------
nosy: +serhiy.storchaka
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22129>
_______________________________________


More information about the Python-bugs-list mailing list