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


Groups > comp.lang.python > #88819

Re: try..except with empty exceptions

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'syntax': 0.04; 'string': 0.09; 'agree,': 0.09; 'forcing': 0.09; 'okay': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'creates': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'parentheses': 0.16; 'tuple': 0.16; 'tuples,': 0.16; 'sat,': 0.16; ':-)': 0.16; 'fix': 0.17; 'wrote:': 0.18; "python's": 0.19; 'cc:addr:python.org': 0.22; 'error': 0.23; 'integer': 0.24; 'cc:2**0': 0.24; 'compare': 0.26; 'right.': 0.26; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'that.': 0.31; "d'aprano": 0.31; 'exceptions': 0.31; 'grouping': 0.31; 'steven': 0.31; 'this.': 0.32; 'another': 0.32; 'sense': 0.34; 'could': 0.34; 'subject:with': 0.35; 'agree': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'consistent': 0.36; 'false': 0.36; 'right?': 0.36; 'pm,': 0.38; 'that,': 0.38; 'does': 0.39; 'moving': 0.39; 'how': 0.40; 'remove': 0.60; 'catch': 0.60; 'truly': 0.60; 'worth': 0.66; 'here': 0.66; '2015': 0.84; 'alternative.': 0.84; 'confusing': 0.84; 'different.': 0.84; 'everything.': 0.84; 'subject:..': 0.84; '9:00': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=ZENIgiwSaclMb4a/MG56THUvN7x8FNZQ6k50S4mRHEc=; b=WtrkC+2lgYbOVPyiw4W5PNMeafVAYCKjjM3jHBRLk47zUl52O+P4ReFLDRZBGaNngn 11CM4wIHcxn8Yl8h4t8ucNarQZ65/d4UXkTkWGK/WhkMAPhLZkrJZYdXXWx4oogvQux0 TEYrLIiNCl8YxZtfq3pvQFzxCT4WxxDevAqdgG38JGXgkK9XeUMvbSk769PkCw0h61lw E1YH7X8pi9m7/FcdHhq3bxLNmCz6nHA38HhBkK/UEkRDcNgmJfag00gyYG7iQsGMbjb3 7qdE+Z3FgJWdmcomysJnnbp93xqX6kahuuESjpezLPbmx+7hk2YlITGsgEUV0ynOc6d9 oXQw==
MIME-Version 1.0
X-Received by 10.42.90.208 with SMTP id l16mr8728190icm.59.1428751260945; Sat, 11 Apr 2015 04:21:00 -0700 (PDT)
In-Reply-To <5528feec$0$13002$c3e8da3$5496439d@news.astraweb.com>
References <d1e58c04-9c96-4fb8-a9ce-f56b9cdcd273@googlegroups.com> <mailman.217.1428744459.12925.python-list@python.org> <5528feec$0$13002$c3e8da3$5496439d@news.astraweb.com>
Date Sat, 11 Apr 2015 21:21:00 +1000
Subject Re: try..except with empty exceptions
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.220.1428751263.12925.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1428751263 news.xs4all.nl 2895 [2001:888:2000:d::a6]:59145
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:88819

Show key headers only | View raw


On Sat, Apr 11, 2015 at 9:00 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> Yes, I agree that Python's behaviour here is better than the alternative.
> Having "except ()" catch nothing is consistent with the behaviour with
> other tuples, so I'm okay with that. But it still surprised me :-)

It's worth noting that there's another false parallel here. Grouping
nothing creates something.

x = 1   # x is an integer
x = (1)  # ditto
x = (((((((((1)))))))))  # LITHP

Okay, so adding parentheses does nothing, right? Right.

x =  # syntax error
x = ()  # empty tuple

"Parentheses around nothing" is NOT the same as "nothing". So if you
compare against this, then it makes perfect sense for "except :" and
"except ():" to be distinctly different.

But I agree, it would be very nice if Python 3 could have abolished
the truly confusing part of this, where "except:" catches everything.
Forcing people to spell it "except BaseException:" would fix all of
this. How hard is it to deprecate and then remove that, same as string
exceptions were removed?

You know what, I'm moving that to -ideas.

ChrisA

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


Thread

try..except with empty exceptions Pavel S <pavel@schon.cz> - 2015-04-10 01:48 -0700
  Re: try..except with empty exceptions Chris Angelico <rosuav@gmail.com> - 2015-04-10 18:58 +1000
  Re: try..except with empty exceptions sohcahtoa82@gmail.com - 2015-04-10 12:31 -0700
    Re: try..except with empty exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-11 11:42 +1000
      Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-10 22:23 -0400
        Re: try..except with empty exceptions Rustom Mody <rustompmody@gmail.com> - 2015-04-10 19:38 -0700
          Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-10 23:46 -0400
            Re: try..except with empty exceptions Rustom Mody <rustompmody@gmail.com> - 2015-04-10 21:17 -0700
              Re: try..except with empty exceptions Rustom Mody <rustompmody@gmail.com> - 2015-04-10 21:39 -0700
          Re: try..except with empty exceptions Cameron Simpson <cs@zip.com.au> - 2015-04-11 19:27 +1000
            Re: try..except with empty exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-11 21:00 +1000
              Re: try..except with empty exceptions Chris Angelico <rosuav@gmail.com> - 2015-04-11 21:21 +1000
              Re: try..except with empty exceptions Ian Kelly <ian.g.kelly@gmail.com> - 2015-04-11 12:49 -0600
              Re: try..except with empty exceptions Chris Angelico <rosuav@gmail.com> - 2015-04-12 06:04 +1000
              Re: try..except with empty exceptions Chris Angelico <rosuav@gmail.com> - 2015-04-12 06:05 +1000
        Re: try..except with empty exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-11 17:11 +1000
          Re: try..except with empty exceptions Serhiy Storchaka <storchaka@gmail.com> - 2015-04-11 11:22 +0300
            Re: try..except with empty exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-11 20:47 +1000
          Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-11 06:14 -0400
          Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-11 06:24 -0400
          Re: try..except with empty exceptions Ian Foote <ian@feete.org> - 2015-04-11 15:20 +0100
      Re: try..except with empty exceptions Terry Reedy <tjreedy@udel.edu> - 2015-04-11 04:58 -0400
  Re: try..except with empty exceptions Dave Angel <davea@davea.name> - 2015-04-10 16:27 -0400
  Re: try..except with empty exceptions Rustom Mody <rustompmody@gmail.com> - 2015-04-10 18:56 -0700

csiph-web