[Python-Dev] Proposal for new core module: UserFIle

Keith Dart kdart at kdart.com
Thu Dec 11 19:35:28 EST 2003

On Thu, 2003-12-11 at 16:16, Guido van Rossum wrote:
> > rwio = UserFile.MergedIO(sys.stdin, sys.stdout)
> That's not a motivation.  How does writing rwio.readline() and
> rw.write() enable your program to do something that wasn't possible by
> using sys.stdin and sys.stdout directly?

_MY_ programs could do that, but what if you got some third party module
that wanted a single read/write file object and you wanted to use it on

It makes APIs more regular and consistent by requiring only one
read/write object. For example, the library method could be passed a
single read/write Unix socket, or a read/write TCP socket, or stdio
object (MergedIO object). 

> > Perhaps "merged" is not the right word. It is not intended to merge
> > files, but combine a separate read file object and write file object
> > into one object that can be passed to other library methods that want a
> > single read/write object (such as my "expect" module...)
> Sounds like an API design bug in the expect module to me. :-)

Nope, that's a feature. ;-)

> I don't doubt that.  But you need to *show* how they are useful for
> others, and you need to show that you have thought about how they
> would work well together with the rest of the stdio library.  (This is
> where strip-newline-raise-EOFError breaks down.)

Ok, this one can be removed then. It would not be commonly used anyway.

-- ------------------------------------------------------------------------- 
Keith Dart
<mailto:kdart at kdart.com>
Public key ID: B08B9D2C Public key: <http://www.kdart.com/~kdart/public.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20031211/3761f30d/attachment.bin

More information about the Python-Dev mailing list