On Mon, 20 Aug 2012 23:42:56 +0200, Antoine Pitrou <[email protected]> wrote: > On Mon, 20 Aug 2012 23:17:10 +0200 > Antoine Pitrou <[email protected]> wrote: > > > > Hello, > > > > I was considering a FileIO.writelines() implementation based on > > writev() and I noticed that the current RawIO.writelines() > > implementation is broken: RawIO.write() can return a partial write but > > writelines() ignores the result and happily proceeds to the next > > iterator item (and None is returned at the end). > > > > (it's probably broken with non-blocking streams too, for the same > > reason) > > > > In the spirit of RawIO.write(), I think RawIO.writelines() could return > > the number of bytes written (allowing for partial writes). > > Another possibility would be a separate RawIO.writev() that would allow > partial writes, and to fix RawIO.writelines() to always do complete > writes.
I think writelines doing a partial write is counter-intuitive in the Python context (as well as being contrary to the existing documentation), so I think I'd favor this. --David _______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
