[issue21763] Clarify requirements for file-like objects

R. David Murray report at bugs.python.org
Sun Jun 15 17:29:34 CEST 2014


R. David Murray added the comment:

I don't think that's true, though.  "file like" pretty much means "has the file attributes that I actually use".  That is, it is context dependent (duck typing).

I'm also not sure I see the point in the change.  It is inherent in the definition of what ABCs are.  I think the language should be audited for imperative/prescriptive voice, though:

  Flush and close this stream. If called again, do nothing. Once the file is closed, any operation on the file (e.g. reading or writing) should raise a ValueError.

My use of 'should' there might be controversial, though, since in the default implementation 'will' is correct.  If 'will' is kept, then perhaps some variation of your note would be appropriate.

----------
nosy: +r.david.murray

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


More information about the Python-bugs-list mailing list