Why no open(f, "w").write()?

Steve Holden sholden at holdenweb.com
Mon Jun 3 08:40:51 EDT 2002


"John La Rooy" <larooy at xtar.co.nz> wrote ...
>
> >
> > It is explicitly not a documented part of the interface - the documented
> > part is that it is not safe to rely on this behaviour.
> >
> > When it is explicitly documented that this behaviour is guaranteed now
and
> > forever, for all implementations of Python after a specified version, I
will
> > *consider* using this behaviour. Until then it is not worthy of
> > consideration.
> >
> > Tim Delaney
> >
> >
>
> 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
>

You might want to consider using it for exactly the reason it's been
retained: backward compatibility to older versions of Python in use by your
potential users.

regards
--
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list