[Python-Dev] Proposal for new core module: UserFIle (original) (raw)
Keith Dart kdart at kdart.com
Thu Dec 11 20:04:18 EST 2003
- Previous message: [Python-Dev] Proposal for new core module: UserFIle
- Next message: [Python-Dev] Proposal for new core module: UserFIle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 2003-12-11 at 16:57, 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 stdio? > 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). Well, the standard way of wrapping a file object around a socket pretty much forces you to have separate read and write objects; check out the makefile() method. :-)
Ok, ok. Uncle! ;-) Guess what? I have never used MergedIO myself. It was partly an exercise combining object functionality in an efficient manner (by re-assigning method objects in the instance's namespace). I can drop that one. But... there is a variant in another module that I use.
-- -- ------------------------------------------------------------------------- Keith Dart <mailto:kdart at kdart.com> <http://www.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/be48b990/attachment.bin
- Previous message: [Python-Dev] Proposal for new core module: UserFIle
- Next message: [Python-Dev] Proposal for new core module: UserFIle
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]