Message83783
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." |
|
Date |
User |
Action |
Args |
2009-03-18 22:26:18 | MLModel | set | recipients:
+ MLModel, georg.brandl |
2009-03-18 22:26:17 | MLModel | set | messageid: <1237415177.76.0.586178129986.issue5513@psf.upfronthosting.co.za> |
2009-03-18 22:26:15 | MLModel | link | issue5513 messages |
2009-03-18 22:26:12 | MLModel | create | |
|