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


Groups > comp.lang.python > #88859

Re: try..except with empty exceptions

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.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 <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.021
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'below).': 0.09; 'exception.': 0.09; 'inherited': 0.09; 'pep': 0.09; 'python': 0.11; '2.7?': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'hierarchy': 0.16; 'hmm.': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'pathological': 0.16; 'simplicity,': 0.16; 'simpson': 0.16; 'url:peps': 0.16; 'exception': 0.16; 'wrote:': 0.18; '3.0': 0.19; 'pointed': 0.19; 'to:name:python-list@python.org': 0.22; 'header:User-Agent:1': 0.23; 'url:dev': 0.24; 'cheers,': 0.24; '(see': 0.26; 'possibly': 0.26; 'header:In-Reply-To:1': 0.27; 'leave': 0.29; 'raise': 0.29; '[2]': 0.30; 'statement': 0.30; 'catching': 0.31; "d'aprano": 0.31; 'exceptions': 0.31; 'steven': 0.31; 'probably': 0.32; 'me?': 0.32; 'interface': 0.32; 'url:python': 0.33; "i'd": 0.34; 'could': 0.34; 'subject:with': 0.35; 'basic': 0.35; 'board': 0.35; 'good.': 0.35; 'but': 0.35; 'there': 0.35; 'skip:> 10': 0.36; 'transition': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'starting': 0.37; 'to:addr:python-list': 0.38; 'expect': 0.39; 'does': 0.39; 'itself': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'even': 0.60; 'new': 0.61; 'content- disposition:inline': 0.62; 'great': 0.65; 'occur': 0.65; 'within': 0.65; 'iron': 0.68; 'stated': 0.69; 'enforced': 0.84; 'received:192.168.15': 0.84; 'subject:..': 0.84; 'adrian': 0.91; 'cause,': 0.91
Date Sun, 12 Apr 2015 16:41:23 +1000
From Cameron Simpson <cs@zip.com.au>
To "python-list@python.org" <python-list@python.org>
Subject Re: try..except with empty exceptions
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii; format=flowed
Content-Disposition inline
In-Reply-To <20150412063339.GA16977@cskk.homeip.net>
User-Agent Mutt/1.5.23 (2014-03-12)
References <20150412063339.GA16977@cskk.homeip.net>
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.241.1428820887.12925.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1428820887 news.xs4all.nl 2914 [2001:888:2000:d::a6]:41412
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:88859

Show key headers only | View raw


On 12Apr2015 16:33, Cameron Simpson <cs@zip.com.au> wrote:
>Finally, if we were to expunge support for "except:", one would also need a 
>cast iron guarrentee that no exception could possibly occur which was not a 
>subclass of BaseException. I'd expect that to mean that "raise" of a 
>non-instance of BaseException to itself raise a TypeError.

And I see that Steven D'Aprano has already pointed out PEP 352:

  http://www.python.org/dev/peps/pep-0352/

which is marked "Status: Final". It says:

  The raise statement will be changed to require that any object passed to it 
  must inherit from BaseException. This will make sure that all exceptions fall 
  within a single hierarchy that is anchored at BaseException [2] . This also 
  guarantees a basic interface that is inherited from BaseException. The change 
  to raise will be enforced starting in Python 3.0 (see the Transition Plan 
  below).

Hmm. Not in 2.7? I can see the breakage it could cause, but where does that 
leave me? I think I could probably move to catching Exception almost across the 
board even in 2.5+ and feel pretty good.

Cheers,
Cameron Simpson <cs@zip.com.au>

If your new theorem can be stated with great simplicity, then there
will exist a pathological exception.    - Adrian Mathesis

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


Thread

Re: try..except with empty exceptions Cameron Simpson <cs@zip.com.au> - 2015-04-12 16:41 +1000

csiph-web