Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104593

Re: Other difference with Perl: Python scripts in a pipe

From Ethan Furman <ethan@stoneleaf.us>
Newsgroups comp.lang.python
Subject Re: Other difference with Perl: Python scripts in a pipe
Date 2016-03-11 00:55 -0800
Message-ID <mailman.5.1457686555.26429.python-list@python.org> (permalink)
References (2 earlier) <nbsral$vpa$1@ger.gmane.org> <mailman.159.1457648213.15725.python-list@python.org> <nbt14l$e87$1@gioia.aioe.org> <mailman.161.1457654957.15725.python-list@python.org> <nbt3bv$gp9$1@gioia.aioe.org>

Show all headers | View raw


On 03/10/2016 04:26 PM, Fillmore wrote:
> On 3/10/2016 7:08 PM, INADA Naoki wrote:
>
>> 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)
>>
>
> I don't like it. It makes Python not so good for command-line utilities

You don't like typing two extra lines of code?

Or don't you like needing to understand what is going on so you know 
when to silence errors?

The try/except paradigm is very useful -- it's worth learning.

--
~Ethan~

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Other difference with Perl: Python scripts in a pipe Fillmore <fillmore_remove@hotmail.com> - 2016-03-10 16:33 -0500
  Re: Other difference with Perl: Python scripts in a pipe Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-10 14:46 -0700
    Re: Other difference with Perl: Python scripts in a pipe Fillmore <fillmore_remove@hotmail.com> - 2016-03-10 17:04 -0500
  Re: Other difference with Perl: Python scripts in a pipe Peter Otten <__peter__@web.de> - 2016-03-10 23:09 +0100
  Re: Other difference with Perl: Python scripts in a pipe Ian Kelly <ian.g.kelly@gmail.com> - 2016-03-10 15:16 -0700
    Re: Other difference with Perl: Python scripts in a pipe Fillmore <fillmore_remove@hotmail.com> - 2016-03-10 18:48 -0500
      Re: Other difference with Perl: Python scripts in a pipe INADA Naoki <songofacandy@gmail.com> - 2016-03-11 09:08 +0900
        Re: Other difference with Perl: Python scripts in a pipe Fillmore <fillmore_remove@hotmail.com> - 2016-03-10 19:26 -0500
          Re: Other difference with Perl: Python scripts in a pipe Alan Bawden <alan@csail.mit.edu> - 2016-03-11 01:45 -0500
            Re: Other difference with Perl: Python scripts in a pipe Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-11 12:15 +0200
          Re: Other difference with Perl: Python scripts in a pipe Ethan Furman <ethan@stoneleaf.us> - 2016-03-11 00:55 -0800

csiph-web