]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
SF patch 1094011: Docs for file() vs open().
authorRaymond Hettinger <python@rcn.com>
Fri, 7 Jan 2005 04:33:44 +0000 (04:33 +0000)
committerRaymond Hettinger <python@rcn.com>
Fri, 7 Jan 2005 04:33:44 +0000 (04:33 +0000)
Doc/lib/libfuncs.tex

index 95ca9eb025cd82483f7ae317e186889044780afc..6b853f3d02b953c9ff5310811334d95aa346df4e 100644 (file)
@@ -416,9 +416,12 @@ class C:
     after any I/O has been performed, and there's no reliable way to
     determine whether this is the case.}
 
-  The \function{file()} constructor is new in Python 2.2.  The previous
-  spelling, \function{open()}, is retained for compatibility, and is an
-  alias for \function{file()}.
+  The \function{file()} constructor is new in Python 2.2 and is an
+  alias for \function{open()}.  Both spellings are equivalent.  The
+  intent is for \function{open()} to continue to be preferred for use
+  as a factory function which returns a new \class{file} object.  The
+  spelling, \class{file} is more suited to type testing (for example,
+  writing \samp{isinstance(f, file)}).
 \end{funcdesc}
 
 \begin{funcdesc}{filter}{function, list}