Message262837
I'm sorry, I'm still not following the argument that `write` is likely to return nothing. `RawIOBase` and `BufferedIOBase` both document that `write` must return the number of written bytes; if you don't return that, you break anything that assumes you do, as documented (because both patterns for checking if you need to keep looping are both TypeErrors: `written = 0; written += None` and `None < len(data)`); and if you ignore the return value, you fail when using any `IOBase` object that *isn't* buffered (exactly this case).
But you are definitely right, explicitly checking for None can be done. It adds a trivial amount of overhead, but this isn't a production server. The only cost is code readability.
Good point about the explicit calls to `flush()`, I thought flush was a no-op in some streams, but that's only the case for streams where it doesn't already matter. |
|
Date |
User |
Action |
Args |
2016-04-04 00:10:24 | jmadden | set | recipients:
+ jmadden, pje, martin.panter, Jonathan Kamens, marcjofre, Paolo Veglia |
2016-04-04 00:10:24 | jmadden | set | messageid: <1459728624.11.0.886289938166.issue24291@psf.upfronthosting.co.za> |
2016-04-04 00:10:24 | jmadden | link | issue24291 messages |
2016-04-04 00:10:23 | jmadden | create | |
|