[docs] [issue21763] Clarify requirements for file-like objects
report at bugs.python.org
Mon Jun 16 03:26:34 CEST 2014
Raymond Hettinger added the comment:
[R David Murray]
>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).
That is pretty much on-target.
Also, the phrase "file-like" has been used very loosely from Python's inception. Laying down a "mandatory" specification doesn't match the reality of how the phrase is used or the way our code has been written.
> Maybe I'm missing some important point here
Yes, I think you are. That is evident in this and your other tracker items whose theme is "there must be precisely documented rules for everything, all expectations, norms, cultural conventions, patterns must be written down, made precise, and enforced, etc".
Before creating more tracker items, please take time to learn about how Python's history, how it is used, and its cultural norms. In particular, read the Zen of Python, consider what is meant by duck-typing, what is meant by "a consenting adults language", what is meant by over-specification, etc. Python is quite different from Java in this regard.
In a quest for "tell me exactly what I have to do", I think you're starting to make-up new rules that don't reflect the underlying reality of
the actual code or its intended requirements.
I recommend this tracker item be closed for the reasons listed by Nick Coghlan and David Murray. I think the proposed patch doesn't make the docs better, and that it seeks to create new made-up rules rather than documenting the world as it actually exists.
Side-note: The place to talk about what "file-like" means is the glossary. The ABC for files and the term "file-like" are related but are not equal.
Python tracker <report at bugs.python.org>
More information about the docs