[Python-Dev] str object going in Py3K

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 16 04:06:45 CET 2006

Barry Warsaw wrote:

> If we go with two functions, I'd much rather hang them off of the file
> type object then add two new builtins.  I really do think file.bytes()
> and file.text() (a.k.a. open.bytes() and open.text()) is better than
> opentext() or openbytes().

I'm worried about feeping creaturism of the file type
here. To my mind, the file type already has too many
features, and this hinders code that wants to define
its own file-like objects.

In 3.0 I'd like to see the file type reduced to having
as simple an interface as possible (basically just
read/write) and all other stuff (readlines, text codecs,
etc.) implemented as wrappers around it.

To be compatible with that model, opentext() etc.
need to be factory functions returning the appropriate
stack of objects. As such they shouldn't be class
methods of any type.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiam!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list