Why no open(f, "w").write()?
Delaney, Timothy
tdelaney at avaya.com
Mon Jun 3 02:53:55 EDT 2002
> From: John La Rooy [mailto:larooy at xtar.co.nz.avaya.com]
>
> It's unlikely to be explicitly documented. from the docs...
>
> The file() constructor is new in Python 2.2. The previous
> spelling, open(),
> is retained for compatibility, and is an alias for file().
>
> So you shouldn't be using open() in new programs anyway
Yes - but *file objects* have been part of Python for a long time, and the
docs do not state anywhere I could find (I may be wrong) that *file objects*
have a destructor that closes the file.
The name used to create a file object (be it file, open or wibble) is
unimportant.
Tim Delaney
More information about the Python-list
mailing list