[Python-3000] sys.stdin and sys.stdout with textfile
Guido van Rossum
guido at python.org
Wed Sep 13 20:06:05 CEST 2006
On 9/11/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>
> > All sorts of things are different when reading stdin vs. opening a
> > filename. e.g. stdin may be a pipe.
>
> Which suggests that if anything is going to try
> to guess the encoding, it would be better for it
> to start reading from the actual stream you're
> going to use and buffer the result, rather than
> rely on being able to open it separately.
Right. The filename is useless. The stream may or may not be seekable
(sometimes even stdin is!). Having a buffering layer in between would
make it possible to peek ahead in the buffer.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list