A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-January/115480.html below:

[Python-Dev] Backwards incompatible sys.stdout.write() behavior in Python 3 (Was: [Python-ideas] Pythonic buffering in Py3 print())

[Python-Dev] Backwards incompatible sys.stdout.write() behavior in Python 3 (Was: [Python-ideas] Pythonic buffering in Py3 print()) [Python-Dev] Backwards incompatible sys.stdout.write() behavior in Python 3 (Was: [Python-ideas] Pythonic buffering in Py3 print())Antoine Pitrou solipsis at pitrou.net
Fri Jan 13 17:19:08 CET 2012
On Fri, 13 Jan 2012 17:00:57 +0100
Xavier Morel <python-dev at masklinn.net> wrote:
> FWIW this is not restricted to Linux (the same behavior change can
> be observed in OSX), and the script is overly complex you can expose
> the change with 3 lines
> 
>     import sys
>     sys.stdout.write('promt>')
>     sys.stdin.read(1)
> 
> Python 2 displays "prompt" and terminates execution on [Return],
> Python 3 does not display anything until [Return] is pressed.
> 
> Interestingly, the `-u` option is not sufficient to make
> "prompt>" appear in Python 3, the stream has to be flushed
> explicitly unless the input is ~16k characters (I guess that's
> an internal buffer size of some sort)

"-u" forces line-buffering mode for stdout/stderr, which is already the
default if they are wired to an interactive device (isattr() returning
True).

But this was already rehashed on python-ideas and the bug tracker, and
apparently Anatoly thought it would be a good idea to post on a third
medium. Sigh.

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4