Other difference with Perl: Python scripts in a pipe

INADA Naoki songofacandy at gmail.com
Thu Mar 10 19:08:55 EST 2016


On Fri, Mar 11, 2016 at 8:48 AM, Fillmore <fillmore_remove at hotmail.com>
wrote:

> On 3/10/2016 5:16 PM, Ian Kelly wrote:
>
>>
>> Interesting, both of these are probably worth bringing up as issues on
>> the bugs.python.org tracker. I'm not sure that the behavior should be
>> changed (if we get an error, we shouldn't just swallow it) but it does
>> seem like a significant hassle for writing command-line
>> text-processing tools.
>>
>
> is it possible that I am the first one encountering this kind of issues?
>
>
No.  I see it usually.

Python's zen says:

> Errors should never pass silently.
>    Unless explicitly silenced.

When failed to write to stdout, Python should raise Exception.
You can silence explicitly when it's safe:

try:
    print(...)
except BrokenPipeError:
    os.exit(0)



More information about the Python-list mailing list