[Python-Dev] file() or open()?

Tim Peters tim.peters at gmail.com
Thu Jul 8 06:41:18 CEST 2004


If you do a cvs annotate on Misc/NEWS, you'll find that Guido gets the
blame, in rev 1.255, for this blurb:

"""
- The builtin file type can be subclassed now.  In the usual pattern,
 "file" is the name of the builtin type, and file() is a new builtin
 constructor, with the same signature as the builtin open() function.
 file() is now the preferred way to open a file.
"""

However, just as I finished pasting that in, he used the time machine
to shift the blame on me, in rev 1.242.  My memory was also altered,
so that I seem to really believe that was my understanding at the
time.  But I usually continued to use open() anyway, proving something
or other.  I'm still unclear about what (if anything) file() should be
used for.


More information about the Python-Dev mailing list