Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'say,': 0.05; 'expected.': 0.09; 'omit': 0.09; 'works.': 0.09; 'python': 0.11; '"to': 0.16; 'iterable:': 0.16; 'loops': 0.16; 'ought': 0.16; 'really?': 0.16; 'syntax,': 0.16; 'true:': 0.16; 'tuple': 0.16; 'tuple.': 0.16; 'exception': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'work,': 0.20; '>>>': 0.22; 'saying': 0.22; 'separate': 0.22; 'header:User-Agent:1': 0.23; 'instead.': 0.24; 'tells': 0.24; 'extension': 0.26; 'this:': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; "i'm": 0.30; 'code': 0.31; '>>>>': 0.31; "d'aprano": 0.31; 'exceptions': 0.31; 'steven': 0.31; 'types.': 0.31; 'could': 0.34; 'subject:with': 0.35; 'objects': 0.35; 'but': 0.35; 'acceptable': 0.36; 'var': 0.36; 'possible': 0.36; 'should': 0.36; 'two': 0.37; 'list': 0.37; 'expected': 0.38; 'convention': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'expect': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'catch': 0.60; 'dave': 0.60; "you're": 0.61; 'for:': 0.64; 'received:74.208': 0.68; '2015': 0.84; 'remembering': 0.84; 'subject:..': 0.84; 'angel': 0.91 Date: Fri, 10 Apr 2015 23:46:43 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: try..except with empty exceptions References: <64a75c32-e0ab-4ce0-9373-358c2669fe6e@googlegroups.com> <785010c0-6bcc-46d7-b7e0-0ed062fabbc7@googlegroups.com> <55287c0d$0$13000$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:1hxqJSQHcgYWHAecqV4Oa1wgiNOL+VNRzyR7W1rfHAWk4nNHJiP EZ08nEn2SEvClSyte1ErEY7vb7a+57buxYkauKc5ygcI6tYFQXGihcZ0dV/J9cqJX9WAa7r pjXtI098Fb5dyukb6lAG6VMnNKJaGk4rfCXvf7TltP0tw+lX6h+ym9PKwjtFHyKOFQ3RKNZ hmgSbQ5KZJzBL8FVt7wgA== X-UI-Out-Filterresults: notjunk:1; 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1428724013 news.xs4all.nl 2892 [2001:888:2000:d::a6]:41719 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88799 On 04/10/2015 10:38 PM, Rustom Mody wrote: > On Saturday, April 11, 2015 at 7:53:31 AM UTC+5:30, Dave Angel wrote: >> On 04/10/2015 09:42 PM, Steven D'Aprano wrote: >>> On Sat, 11 Apr 2015 05:31 am, sohcahtoa82 wrote: >>> >>>> It isn't document because it is expected. Why would the exception get >>>> caught if you're not writing code to catch it? If you write a function >>>> and pass it a tuple of exceptions to catch, I'm not sure why you would >>>> expect it to catch an exception not in the tuple. Just because the tuple >>>> is empty doesn't mean that it should catch *everything* instead. That >>>> would be counter-intuitive. >>> >>> Really? I have to say, I expected it. >>> >>> >> >> I'm astounded at your expectation. That's like saying a for loop on an >> empty list ought to loop on all possible objects in the universe. > > To work, this analogy should also have two python syntaxes like this: > > "Normal" for-loop: > for var in iterable: > suite > > "Empty" for-loop: > for: > suite > That tells me nothing about your opinions. What did you mean by the phrase "to work"? My analogy already works. The for loop on an empty list loops zero times. Just like try/except on an empty tuple catches zero exception types. As for the separate syntax, that might be an acceptable extension to Python. But it already has a convention for an infinite loop, which is while True: I'm pretty sure do{} works as an infinite loop in C, but perhaps I'm remembering some other language where you could omit the conditional. -- DaveA