Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'try:': 0.09; 'python': 0.11; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'pass': 0.26; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'raise': 0.29; '"",': 0.31; "d'aprano": 0.31; 'exceptions': 0.31; 'steven': 0.31; 'file': 0.32; 'class': 0.32; '(most': 0.33; 'subject:with': 0.35; 'except': 0.35; 'something': 0.35; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'catch': 0.60; 'charset:windows-1252': 0.65; 'everything.': 0.84; 'subject:..': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Serhiy Storchaka Subject: Re: try..except with empty exceptions Date: Sat, 11 Apr 2015 11:22:15 +0300 References: <64a75c32-e0ab-4ce0-9373-358c2669fe6e@googlegroups.com> <785010c0-6bcc-46d7-b7e0-0ed062fabbc7@googlegroups.com> <55287c0d$0$13000$c3e8da3$5496439d@news.astraweb.com> <5528c906$0$12994$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 193.202.118.165 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <5528c906$0$12994$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1428740547 news.xs4all.nl 2865 [2001:888:2000:d::a6]:49092 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88809 On 11.04.15 10:11, Steven D'Aprano wrote: > Anyway, in modern Python (2.6 onwards), now that string exceptions are gone, > you can supply something to catch everything. Or nothing, for that matter: > > BaseException # catch everything Not everything. >>> class A: pass ... >>> try: raise A ... except BaseException: pass ... Traceback (most recent call last): File "", line 1, in __main__.A: <__main__.A instance at 0xb707982c>