Thanks to you and Mathias for the prompt replies.

 >     docstring = unicode( myEditor.toPlainText() )
> In PyQt5 toPlainText() will return a str object for Python3 and a unicode
> object for Python2.
>

And, as Mathias says, it is a copy?...
That is not IMO a good design choice. At least if toPlainText
returns a const QString reference, one can then use r/o QString
methods like count(), contains(), indexOf etc, without penalty.
Also one could provide it to a QRegExp, e.g.:

    j = qre.indexIn( myEditor.toPlainText() )
    while j >= 0 :
        # ...do something with qre.cap(0)...
        j = qre.indexIn( myEditor.toPlainText() , j )

This is more or less the patther of a syntax highlighter
as well as other possible applications -- and it
would be a catastrophe with a large doc when every
toPlainText call does a new memcopy.

In short, I urge you to leave the conversion to Python str
in the programmer's hands, e.g. via unicode() or str().

Or, find a way to support those "STL-style iterators"
that are currently omitted...?

> Also in regard to making intensive loops faster
> how well do PyQtx calls integrate with Cython or PyPy?
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to