On 2/1/19, Steven D'Aprano <st...@pearwood.info> wrote: > On Fri, Feb 01, 2019 at 07:21:47PM -0600, eryk sun wrote: > >> As soon as "pipe" is mentioned, anyone familiar with the REPL's >> behavior with pipes should know that making this work will require the >> -i command-line option to force interactive mode. Otherwise stdout >> will be fully buffered. For example: > [...] > > I wonder... could Python automatically detect when it is connected to > pipes and switch buffering off?
In most cases we want full buffering when standard I/O is a pipe or disk file. It's more efficient to read/write large chunks from/to the OS. In another message I saw -u mentioned to disable buffering. But that's not sufficient. We need -i to force running the built-in REPL over a pipe, and optionally -q to quiet the initial banner message. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/