stephen at cerebralmaelstrom.com
Tue May 30 12:55:35 CEST 2000
I *believe* you don't actually need to modify stdin/stdout.. Each is
just a basic file-object (implementing read() and write() respectfully?)...
So, if you want to alter their behavior, just make your own little class
that implements read() and write() a la files, then do:
sys.stdin = YourNewStdin
sys.stdout = YourNewStdout
In YourNew* you can write to the origional std(in/out) through the
__stdin__ and __stdout__ file-objects. You could make your stdin/stdout do
just about anything, I think.
Then again, I havn't gone to bed yet tonight so I could still be in my
own little universe of obsessive purplenses.
A[r]TA <arta at NOSPAMx-stream.nl> wrote in message
news:#2z0XYay$GA.311 at net003s...
> I want to write an own INPUT-module.
> But not like the raw_input(). It has to be something like that, but
> it is not allowed to stop de continue streams of data.
> I want it, so I can write commands easily while my server is online.
> If you do it with raw_input() then the select.select() won't continue
> till you hit enter. And that isn't the purpose.
> In the Python-docs the stdin and stdout -modules are mentioned.
> Because they're taking care from the print and raw_input().
> If I could modify them! But that isn't possible, 'cause I don't have
> the source from the sys-module.
> (Maybe, it's possible if there's something in Python like in BASIC
> : the LOCATE-command. You just put the cursor somewhere and there
> it'll print.)
> We shall not cease from exploration, and the end of all our exploring will
> be to arrive where we started and know the place for the first time.
> - T. S. Eliot
More information about the Python-list