Hello folks,

I've put my fears aside and started working on a PSEP. It isn't good
enough (even as a draft) to submit but I will talk about it anyway.

It started as a proposal to change the way the QFile::open method is
used, but expanded to describe changes to all I/O operations.
The QFile::open method returns a boolean indicating the success or
failure of the I/O operation. In case of failure the user must call
QFile::error method to know what happened. Human readable information
is available through the inherited QIODevice::errorString method.

Compare this to opening a file with Python regular functions:

try:
    fd = open('/tmp/file.txt', 'r')
except IOError:
    ...

With the changes proposed on the PSEP we would use the QFile bindings this way:

try:
    fd = QFile('/tmp/file.txt')
    fd.open(QFile.ReadOnly | QFile.Text)
except IOError:
    ...

The information contained in the exception could be gathered from
QFile::error and QIODevice::errorString.
Other candidates are QIODevice::read and QIODevice::write.

This is all for the moment.
Comments are more than welcome.

Cheers,

-- 
Marcelo Lira dos Santos
INdT - Instituto Nokia de Tecnologia
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to