open == file considered harmful (Re: [Python-Dev] RE: rexec.py unuseable)

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Dec 16 18:24:52 EST 2003


Michael Chermside <mcherm at mcherm.com>:

> Suppose that had some code which had an object representing a
> directory, with a method "open(filename, mode='r')" that opened 
> files in the directory. Given this object, you could imagine 
> constructing new objects with more limited capabilities.

With regard to files, we'd almost have something like that
now, if it weren't for the unfortunate fact that the file
type's constructor can be used to open any file.

In light of this, it may have been a serious mistake to
unify the 'file' type and the 'open' function. Is it too
late to back out of that decision?

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list