Question about python 2.4 documentation

Fouff fouff at fouff.com
Tue Apr 19 03:37:47 EDT 2005


Hello all.

I have a small question concerning the functions open(...) and file(...) 
with python 2.4

In the online version of the documentation in the build-in functions 
(section 2.1 http://docs.python.org/lib/built-in-funcs.html) here is an 
quote of the file(...) doc :
> 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)").


In my installed python 2.4 documentation the correspondig quote :
> The file() constructor is new in Python 2.2.
> The previous spelling, open(), is retained for compatibility, and is an alias for file().

If I understand well, in my version it is recommended to use file() 
function instead of open(), and in the online version it is the opposite.

what is the favorite function you recommend me to use ?


Thanks for your responses .



More information about the Python-list mailing list