A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-April/053073.html below:

[Python-Dev] Re: anonymous blocks

[Python-Dev] Re: anonymous blocks [Python-Dev] Re: anonymous blocksTim Delaney tcdelaney at optusnet.com.au
Thu Apr 28 01:07:00 CEST 2005
Guido van Rossum wrote:

>> A minor sticking point - I don't like that the generator has to
>> re-raise any ``StopIteration`` passed in. Would it be possible to
>> have the semantics be: 
>> 
>>     If a generator is resumed with ``StopIteration``, the exception
>>     is raised at the resumption point (and stored for later use).
>>     When the generator exits normally (i.e. ``return`` or falls off
>>     the end) it re-raises the stored exception (if any) or raises a
>> new ``StopIteration`` exception. 
> 
> I don't like the idea of storing exceptions. Let's just say that we
> don't care whether it re-raises the very same StopIteration exception
> that was passed in or a different one -- it's all moot anyway because
> the StopIteration instance is thrown away by the caller of next().

OK - so what is the point of the sentence::

    The generator should re-raise this exception; it should not yield
    another value.  

when discussing StopIteration?

Tim Delaney
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4