osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python 3.2 has some deadly infection


On 6/3/2014 1:16 AM, Gregory Ewing wrote:
> Terry Reedy wrote:
>> The issue Armin ran into is this. He write a library module that makes
>> sure the streams are binary.
>
> Seems to me he made a mistake right there. A library should
> *not* be making global changes like that. It can obtain
> binary streams from stdin and stdout for its own use, but
> it shouldn't stuff them back into sys.stdin and sys.stdout.
>
> If he had trouble because another library did that, then
> that library is broken, not Python.

I agree. The example in Armin's blog rant was an application, an empty 
unix filter (ie, simplified cat clone). For that example the complex 
code he posted to show how awful Python 3 is is unneeded. When I asked 
what he did not directly use the fix in the doc, without the 
scaffolding, he switching to the 'library' module explanation.

The problem is that causal readers like Robin sometimes jump from 'In 
Python 3, it can be hard to do something one really ought not to do' to 
'Binary I/O is hard in Python 3' -- which is is not.

-- 
Terry Jan Reedy