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


Groups > comp.lang.python > #53092

Re: How come StopIteration.__base__ is not BaseException?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'ignored': 0.07; 'except:': 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; 'subject:How': 0.10; 'def': 0.12; 'jan': 0.12; 'clause,': 0.16; 'closed:': 0.16; 'marco': 0.16; 'reason?': 0.16; 'reasonable.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'systemexit': 0.16; 'exception': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'seems': 0.21; '>>>': 0.22; '(in': 0.22; 'header:User-Agent:1': 0.23; 'switched': 0.24; 'why.': 0.24; 'nearly': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'raise': 0.29; '"",': 0.31; 'file': 0.32; '(most': 0.33; 'maybe': 0.34; 'except': 0.35; 'but': 0.35; 'there': 0.35; '2.6': 0.36; 'yield': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'catch': 0.60; 'received:173': 0.61; 'first': 0.61; 'details': 0.65; 'introduction': 0.68; '2.5.': 0.84; 'received:fios.verizon.net': 0.84; 'subject:skip:S 20': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: How come StopIteration.__base__ is not BaseException?
Date Tue, 27 Aug 2013 16:37:05 -0400
References <kvgapp$lh3$1@speranza.aioe.org> <mailman.246.1377547832.19984.python-list@python.org> <521C446B.9040605@gmail.com> <521c6fb9$0$11100$c3e8da3@news.astraweb.com> <521C7935.8080205@gmail.com> <mailman.278.1377629540.19984.python-list@python.org> <kvj01v$s20$1@speranza.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
In-Reply-To <kvj01v$s20$1@speranza.aioe.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.283.1377635844.19984.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1377635844 news.xs4all.nl 15948 [2001:888:2000:d::a6]:35174
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53092

Show key headers only | View raw


On 8/27/2013 3:52 PM, Marco Buttu wrote:
> On 08/27/2013 08:51 PM, Terry Reedy wrote:
>
>> BaseException was added just so it would be possible to catch nearly
>> everything but a few exceptions. The first two were KeyboardInterrupt
>> and SystemExit (in 2.5). GeneratorExit was switched in 2.6, but I forget
>> the details of why.
>
> Maybe in order to don't catch it inside a generator using a except
> Exception clause, because it is used to notify an active generator is
> closed:
>
>  >>> def foogen():
> ...     for i in range(10):
> ...         try:
> ...             yield i
> ...         except:
> ...             print('Catched!')
> ...             # raise
> ...
>  >>> g = foogen()
>  >>> next(g)
> 0
>  >>> g.close()
> Catched!
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> RuntimeError: generator ignored GeneratorExit
>
> Do you remember if this is the reason? Thanks,

I only remember that there was a 'problem' that necessitated a change in 
2.6 after the introduction in 2.5. The above seems reasonable.

-- 
Terry Jan Reedy

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


Thread

How come StopIteration.__base__ is not BaseException? Marco Buttu <marco.buttu@gmail.com> - 2013-08-26 21:37 +0200
  Re: How come StopIteration.__base__ is not BaseException? random832@fastmail.us - 2013-08-26 16:10 -0400
    Re: How come StopIteration.__base__ is not BaseException? Marco Buttu <marco.buttu@gmail.com> - 2013-08-27 08:17 +0200
      Re: How come StopIteration.__base__ is not BaseException? Marco Buttu <marco.buttu@gmail.com> - 2013-08-27 08:18 +0200
      Re: How come StopIteration.__base__ is not BaseException? Steven D'Aprano <steve@pearwood.info> - 2013-08-27 09:22 +0000
        Re: How come StopIteration.__base__ is not BaseException? Marco Buttu <marco.buttu@gmail.com> - 2013-08-27 12:02 +0200
          Re: How come StopIteration.__base__ is not BaseException? Terry Reedy <tjreedy@udel.edu> - 2013-08-27 14:51 -0400
            Re: How come StopIteration.__base__ is not BaseException? Marco Buttu <marco.buttu@gmail.com> - 2013-08-27 21:52 +0200
              Re: How come StopIteration.__base__ is not BaseException? Terry Reedy <tjreedy@udel.edu> - 2013-08-27 16:37 -0400
  Re: How come StopIteration.__base__ is not BaseException? Ethan Furman <ethan@stoneleaf.us> - 2013-08-27 13:00 -0700

csiph-web