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

2014-08-05 Thread R. David Murray
R. David Murray added the comment: Actually, we more or less already do have this function in the stdlib, (I'd guess it is for pretty much the same reason that QT has it), except ours can also truncate sensibly to a given width: >>> import textwrap >>> textwrap.shorten(' lots\t of\nwhites

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

2014-08-03 Thread Serhiy Storchaka
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):

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

2014-08-03 Thread Tobias Leupold
New submission from Tobias Leupold: It would be nice if a function equivalent to Qt's QString::simplified() would be added to Python's strings (cf. http://qt-project.org/doc/qt-4.8/qstring.html#simplified ). I'm not sure if my approach is good or fast, but I added this function to my code lik