Reputation: 11763
I'm most interested in the design decision that led to Python 2.x's write() function returning None instead of the number of bytes written. It would imply some different mental model for the File object -- that it's not just a lightweight wrapper around a UNIX file descriptor.
Here's the documentation I'm referring to: http://docs.python.org/library/stdtypes.html#file.write
Upvotes: 4
Views: 840
Reputation: 8197
From Python official Manual 3.2.2:-
write(b)
Write the bytes or bytearray object, b and return the number of bytes written. When in non-blocking mode, a BlockingIOError is raised if the buffer needs to be written out but the raw stream blocks.
Upvotes: 1