STDIO Questions.

Michael Hudson mwh21 at cam.ac.uk
Tue Nov 14 10:15:51 EST 2000


Peter Hansen <peter at engcorp.com> writes:

> euler27182 at my-deja.com wrote:
> > "Fredrik Lundh" <fredrik at effbot.org> wrote:
> > > you asked the same question yesterday (with a slightly
> > > different capitalization).  here's my reply:
> > >
> > > http://www.deja.com/=dnc/getdoc.xp?AN=692659228
> > 
> > Your answer seems to clarify the problem, but I was hoping for more robust
> > (or platform independant) behaviour from Python.  Oh, well.
> 
> You realize that what you are asking, is for Python to fix an inherently
> platform-specific behaviour issue which no other language or system has
> likely ever fixed?  Not asking much, are you?  ;-)
> 
> Still, it wouldn't be hard to write a little module designed to
> encapsulate the differences between platforms, and use the appropriate
> platform-specific code to do The Right Thing.  I suspect few people feel
> the need.

That's probably not a bad idea for a library module.  I guess the
problem comes with trying to find the suitable lowest common
denominator functionality - you could easily end up reimplementing
curses (which would be pointless!) (Can Python work with curses on
Windows?).

Mini-proposal:

A "kbinput" module.  Has following functions:

read1():
  waits for a key to be presses.  Returns it, does not echo it
  to the screen.

read1nb():
  like read1(), but non-blocking.

Would this fly?  (next to no chance of it working on the Mac, I'd have
thought).  I could implement it for unix easily enough (I think).

Cheers,
M.

-- 
  But since I'm not trying to impress  anybody in The Software Big 
  Top, I'd rather walk the wire using a big pole, a safety harness, 
  a net, and with the wire not more than 3 feet off the ground.
                                   -- Grant Griffin, comp.lang.python



More information about the Python-list mailing list