[Python-Dev] Re: anonymous blocks

Duncan Booth duncan.booth at suttoncourtenay.org.uk
Wed Apr 27 16:19:35 CEST 2005


Jim Fulton <jim at zope.com> wrote in news:426F9723.4080604 at zope.com:

>> No, the return sets a flag and raises StopIteration which should make
>> the iterator also raise StopIteration at which point the real return
>> happens. 
> 
> Only if exc is not None
> 
> The only return in the pseudocode is inside "if exc is not None".
> Is there another return that's not shown? ;)
> 

Ah yes, I see now what you mean. 

I would think that the relevant psuedo-code should look more like:

            except StopIteration:
                if ret:
                    return exc
                if exc is not None:
                    raise exc   # XXX See below
                break


More information about the Python-Dev mailing list