[Python-Dev] Python3: speed efficiency vs user friendliness (my first experience)
Nick Coghlan
ncoghlan at gmail.com
Wed Mar 23 13:58:26 CET 2011
On Tue, Mar 22, 2011 at 9:57 PM, anatoly techtonik <techtonik at gmail.com> wrote:
> For example, now I need to remember that on Windows I need to flush
> output every time when I want the result of print() with end!='\n' to
> appear on the screen immediately. And for the most of my legacy
> scripts I used end='\n' when I want to output some progress to user. I
> am surprised to know this never worked on Linux, but what I really
> didn't expect is to see that choice is made not in user's favor, but
> in a favor of speed. This way we'll be writing in a cross-platform
> assembly language named 'Python' soon. =)
Python 3 actually chose *cross-platform consistency* over user
convenience when switching away from the platform IO implementations.
That means things like line buffering of stdout is now the default on
all platforms, including Windows, and there is now a meaningful
distinction between files opened in binary mode (returning bytes) and
files opened in text mode (returning strings) on all platforms, rather
than *just* on Windows (where the "b" mode flag was historically
always needed to avoid corrupting binary files that happened to
contain CRLF sequences).
There are several ways to get unbuffered IO back in a cross-platform
manner, but efficient codec operation means working that way by
default would be a really bad idea. Users may *say* they prefer
convenience over speed, but that's only true until the lack of speed
becomes intolerably slow.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list