[PyKDE] Working with QTextStream

Phil Thompson phil at river-bank.demon.co.uk
Sat Jun 30 20:55:58 BST 2001


Boudewijn Rempt wrote:
> 
> I'm investigating PyQt's stream classes - since they are implemented,
> I need to say something about them. From what I've seen up to now
> I understand that it isn't possible to actually write to the streams,
> since there is no write method that corresponds to the read method.
> You're supposed to use C++'s << operator.
> 
> Things don't work that way on Python. Would it be possible to make
> a synthetic write method that replaces <<? Or is that just to much
> work to make something work for which there are perfect Python
> alternatives?

PyQt makes very little use of operators, even though SIP supports
providing handwritten code to provide class specific implementations of
all Python operators (including <<). So it would be possible to
implement << for Qt streams.

Generally I didn't bother with things where there was clearly a Python
way of doing things - like i/o. I suspect though that fully implementing
the streams might be useful.

Phil




More information about the PyQt mailing list