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

Guido van Rossum guido at python.org
Thu Dec 11 19:16:37 EST 2003

> > It looks like you are simply making all write operations go to the
> > writable object and all the read operations go to the readable object.
> > That's not a very sophisticated notion of "merging", and I'm not sure
> > what the point is.  Perhaps some examples of how you use this would
> > help.
> A quick example:
> import os
> import UserFile
> r, w = os.pipe()
> rf = os.fdopen(r)
> wf = os.fdopen(w)
> fo = UserFile.MergedIO(rf, wf)
> _or_
> 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?

> 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. :-)

> > I note that in general your proposals are low on motivation, which is
> > going to do a lot of damage to your case if you don't fix this soon.
> > You may be underestimating the level of motivation needed to get
> > features added to the stdlib -- it's "batteries included" but also (to
> > some extent) "TOOWTDI".
> Hm, ok. more use cases? What I have submitted, and will submit, exist
> because I did need them for real work at some point, and have found them
> to be re-usable.

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.)

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list