Python 3 is killing Python

Chris Angelico rosuav at gmail.com
Wed Jul 16 08:50:26 CEST 2014


On Wed, Jul 16, 2014 at 4:44 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> Python defaults to the most common case, where they're connected to a
>> console, and does its best to allow print() to write Unicode to any
>> console.
>
> I don't know where you pull your statistics.

Heaps and HEAPS of personal experience, of myself and many other
people. I frequently run programs that manipulate text and work with a
console that displays text, which means that a consistent encoding
(usually UTF-8) can be hidden away as an implementation detail. As
long as the console correctly announces the encoding it expects and
the program correctly writes in that encoding, all is well, and the
program can simply "write text to the console".

> Be that as it may, the main purpose of sys.stdin is to receive the
> workload and sys.stdout to deliver the goods.

Yes, but is that workload text or bytes? To be sure, there are
programs whose stdin is usually or always bytes, but most use text.
The default should be the most common and most useful option, and the
alternative should be available when you want it.

ChrisA



More information about the Python-list mailing list