[ANN] Python 2.4 Quick Reference available

David M. Cooke cookedm+news at physics.mcmaster.ca
Sat Feb 19 14:04:57 EST 2005


"Pete Havens" <peter.havens at gmail.com> writes:

> The is awesome! Thanks. I did notice one thing while reading it. In the
> "File Object" section, it states:
>
> "Created with built-in functions open() [preferred] or its alias
> file()."
>
> ...this seems to be the opposite of the Python documentation:
>
> "The file() constructor is new in Python 2.2. The previous spelling,
> open(), is retained for compatibility, and is an alias for file()."

Except if you look at the current development docs
(http://www.python.org/dev/doc/devel/lib/built-in-funcs.html) it says

"""
The file() constructor is new in Python 2.2 and is an alias for
open(). Both spellings are equivalent. The intent is for open() to
continue to be preferred for use as a factory function which returns a
new file object. The spelling, file is more suited to type testing
(for example, writing "isinstance(f, file)").
"""

... which more accurately reflects what I believe the consensus is
about the usage of open vs. file.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list