[issue21763] Clarify requirements for file-like objects

Nick Coghlan report at bugs.python.org
Tue Jun 17 23:52:47 CEST 2014


Nick Coghlan added the comment:

I can add a third suggestion: a "HOWTO" guide on implementing and using
file-like objects. It's actually a somewhat complex topic with various
trade-offs involved, particularly in Python 3 where the differences between
binary and text IO are greater. It could also point users to existing
file-like objects that they may have missed (like the spooled temporary
file support in tempfile).

On the more specific matter at hand, I think "close() is idempotent" is not
only one of our most pervasive assumptions about file-like objects, but
also an assumption we tend to make about resources *in general*.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21763>
_______________________________________


More information about the Python-bugs-list mailing list