[issue5513] "What's New" should say VERY CLEARLY that the type file is gone
Mitchell Model
report at bugs.python.org
Wed Mar 18 23:26:18 CET 2009
New submission from Mitchell Model <mlm at acm.org>:
MAIN POINT
The Python 3 "What's New" should SCREAM that the type file is gone, not
just that people should use the function open() to open files, since
that has been a recommendation for quite a while.
EXPLANATION
In multiple readings of the Python 3 "What's New" I blew right past the
"Removed file. Use open().", since I've been using open() instead of
file() for a long time. I didn't notice that unlike the preceding
several lines, there were no parentheses after "file" and that this line
was literally saying there was no longer a type called "file".
OBSERVATIONS
(1) If the line is meant to say that you can no longer call file() as a
function -- which would be strange if it were still a type -- then it is
missing its parentheses.
(2) If the line is meant to say that there is no longer a file type, as
it apparently means to say since in fact -- and to my great surprise --
there really IS no type called "file" in Python 3 (I discovered that
doing a dir(file) to check whether file provided method function I
thought it did instead of taking the time to look it up.) then there is
a grammatical problem with the line since a (n old) type shouldn't be
equated to a function call.
(3) I predict that anyone who has more than a passing acquaintance with
Python 2 will be similarly shocked when they find out that what they get
back from open() is a _io.TextIOWrapper (and, by the way, that they have
to import _io or at least _io.TextIOWrapper to be able to do a dir on
it). Likewise for help(file) and help(_io.TextIOWrapper). There should
be a very prominent statement that as part of the reimplementation of
the io system, the type file has been replaced by _io.TextIOWrapper.
RECOMMENDATION
The line
"Removed file. Use open()."
should be replaced with:
"The type file has been removed; use open() to open a file."
or possibly:
"The type file has been replaced by _ioTextIOWrapper; use open() to
open a file; open returns an instance of _ioTextIOWrapper."
----------
assignee: georg.brandl
components: Documentation
messages: 83783
nosy: MLModel, georg.brandl
severity: normal
status: open
title: "What's New" should say VERY CLEARLY that the type file is gone
versions: Python 3.0, Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5513>
_______________________________________
More information about the Python-bugs-list
mailing list