Mitchell Model <m...@acm.org> added the comment: At 11:03 AM -0400 3/19/09, Mitchell L Model wrote: >>Martin v. Löwis <mar...@v.loewis.de> added the comment: >> >>> The Python 3 "What's New" should SCREAM that the type file is gone >> >>I don't think the documentation should ever SCREAM.
No, of course not. I was being extreme. The problem with the laconic alternative is that it sets traps for people. It reminds me of wrestling Stroustrop's first book on C++ where all this weird behavior happened and when you went back to the book you could find one sentence whose third-level implication was consistent with the explanation. What I'm saying is that it's not enough to say to use open(). Don't you think people ever referred to the type file directly? As in help(file) or dir(file) or file.somemethod(receiver, arg)? Or even storing a file method in a dictionary for dispatch? It doesn't matter whether any of these were a good idea, I claim they were quite ingrained in Python 2 user's minds. The changes in the sequence types are quite substantial, but they are explained in detail. This isn't. In reviewing the "What's New" for the purpose of this reponse I noticed an earlier mention of sys.stdin, sys.stdout, and sys.stderr, where it says they are now instances of TextIOBase. (They are actually instances of TextIOWrapper, just like the result of open().) So why can't the documentation of open() say that it returns an instance of TextIOBase too? At least add to the paragraph of PEP 3116 that "the old file type is gone". Maybe that's better than discussing it in conjunction with open(), in which case the statement using open() instead of file should read that open replaces "file()", not "file". It just seems like a very wide trap to never mention that the whole file type is gone. It does not follow from the two facts that one should use open() instead of file() and that the IO system has been rewritten, that there is no file type. Even if whatever open returns has the same interface as the old file type. >> >> > "The type file has been replaced by _ioTextIOWrapper; use open() to >> > open a file; open returns an instance of _ioTextIOWrapper." >> >>That would be an incorrect statement: there are multiple types that >>replace the 2.x file type. See the documentation of the io module for >>details. OK, I didn't follow the technical details through and, as I said above, I hadn't noticed the earlier mention of TextIOBase for sys.stdout, etc. So just say something like "The type file is gone, replaced by classes in the IO module. Use open() to open a file." And maybe add that it returns an instance of TextIOBase or TextIOWrapper, whichever is deemed more appropriate. Whatever else it says with regard to the above comments the "What's New" really needs to explicitly say that the file type is gone. And I apologize for screaming in my entry. I was just so incredibly shocked when I figured out what was going on. -- --- Mitchell ---------- title: "What's New" should say VERY CLEARLY that the type file is gone -> "What's New" should say VERY CLEARLY that the type file is gone _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5513> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com