New submission from Jean-Paul Calderone <exar...@divmod.com>: The actual file type rejects None in places like as the argument to read or readlines. StringIO.StringIO, io.BytesIO, and io.StringIO all accept None to mean the same as passing no argument at all.
This makes it tricky to write code that might operate on any of these types (as many APIs accepting a "file-like object" try to). Testing with one will not demonstrate that code works with any. In particular, it's common to start test with StringIO, which is more liberal, and only discover a problem when code is run for real against an actual file. ---------- components: Library (Lib) messages: 95439 nosy: exarkun severity: normal status: open title: StringIO.StringIO, io.BytesIO, and io.StringIO accept None in places where other file-like objects don't _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7349> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com