[Python-Dev] file() vs open(), round 7

Aahz aahz at pythoncraft.com
Mon Dec 26 05:38:31 CET 2005


Guido sez in 
http://mail.python.org/pipermail/python-dev/2004-July/045921.html
that it is not correct to recommend using ``file()`` instead of
``open()``.  However, because ``open()`` currently *is* an alias to
``file()``, we end up with the following problem (verified in current
HEAD) where doing ``help(open)`` brings up the docs for ``file()``:

>>> help(open)
Help on class file in module __builtin__:

class file(object)
 |  file(name[, mode[, buffering]]) -> file object
 |
 |  Open a file.  The mode can be 'r', 'w' or 'a' for reading (default),
[...]
 |  Note:  open() is an alias for file().

This is confusing.  I suggest that we make ``open()`` a factory function
right now.  (I'll submit a bug report (and possibly a patch) after I get
agreement.)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Don't listen to schmucks on USENET when making legal decisions.  Hire
yourself a competent schmuck."  --USENET schmuck (aka Robert Kern)


More information about the Python-Dev mailing list