[Python-Dev] POSIX [Fuzziness in io module specs]
Antoine Pitrou
solipsis at pitrou.net
Sat Sep 19 19:04:13 CEST 2009
Hello,
Pascal Chambon <pythoniks <at> gmail.com> writes:
> @pitrou: non-blocking IO in python ? which ones are you thinking about ?
I was talking about the existing support for non-blocking IO in the FileIO class
(look up EAGAIN in fileio.c), as well as in the Buffered* objects.
> If it's too late to modify the IO API, too bad, but I don't feel
> comfortable with the "truncate" word.
It's certainly too late to modify the IO API only for naming purposes.
> And I don't like the fact that we
> move the filepointer to prevent it from exceeding the file size,
I don't see what you mean:
>>> with open('foobar', 'wb') as f:
... f.truncate(0)
...
0
>>> os.stat('foobar').st_size
0
>>> with open('foobar', 'wb') as f:
... f.truncate(16)
... f.tell()
...
16
16
>>> os.stat('foobar').st_size
16
> I had the feeling that IOErrors were for operations on file streams
> (opening, writing/reading, closing...), whereas OSErrors were for
> manipulations on filesystems (renaming, linking, stating...) and
> processes.
Ok, but the distinction is certainly fuzzy in many cases. I have no problem with
trying to change the corner cases you mention, though.
Regards
Antoine.
More information about the Python-Dev
mailing list