Nikolaus Rath added the comment: "R. David Murray" <rep...@bugs.python.org> writes: > R. David Murray added the comment: > > Nikolaus: while I agree that Raymond's comments were a bit strongly > worded, it doesn't read to me as if the thread you link to is on point > for this issue. The thread was focused on a *specific* question, that > of calling close twice. The question of what the docs mean by "a file > like object" is a different question. Specifically, you will note > that "duck typing" never came up in that thread (as far as I > remember).
That's quite correct. But did not come up in the original issue report either - that's why I still don't understand why we're discussing it here at all. My line of thought was as follows: - Standard library assumes that close() is idempotent in many places - Currently this isn't documented clearly - The best place to make it more explicit seemed to be the description of IOBase - However, changing the description of only IOBase.close() could easily give the impression that close() is somehow special, and that fewer/no assumptions are made in the standard lbirary about the presence/behavior of the other methods (e.g. fileno or readable). - Therefore, to me the best course of action seemed to add a paragraph explicitly describing that the standard library may assume that *any* method/attribute of a stream object behaves as described for IOBase. I still don't see how this contradicts / interacts with the concept of duck typing. I think the documentation (with and without the patch) clearly implies that you can implement an object that does not have the full IOBase API and successfully hand it to some standard library function - it's just that in that case you can't complain if it breaks. Or is the point of contention just the title of this issue? Maybe it was poorly chosen, I guess "Clarify standard library's expectations from stream objects" would have been better. Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.« ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21763> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com