Could Emacs be rewritten in Python?
Greg Ewing (using news.cis.dfn.de)
ckea25d02 at sneakemail.com
Thu Apr 17 04:06:02 CEST 2003
Robin Munn wrote:
> I would call using Unix pipes
> "rebinding stdout", handled by the shell.
That's not quite the same thing, since the shell passes
the new stdin/out/err to the invoked process as parameters.
It doesn't change its *own* stdin/out/err, invoke the
process, and then change them back.
> I've got this function that prints something to sys.stdout. And this
> function is not under my control.
If this is a library function, or anything else intended
to be called in a variety of circumstances, then I would
say it is badly designed. It should *not* be writing to
sys.stdout, or at least an alternative interface should
be provided which lets you specify where the output goes.
> How would you suggest capturing output *without* rebinding sys.stdout?
In that case, you have no choice. But it's not your
fault, it's the fault of whoever wrote the function.
The bad design is in the function, not the code
which is calling it.
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
More information about the Python-list