[Python-Dev] why not "return StopIteration"?

Tim Peters tim.one@home.com
Fri, 22 Jun 2001 14:11:13 -0400

[Thomas Wouters]
> I don't get this. Currently, (unless Just checked in his patch)
> generators work in exactly that way: the compiler compiles 'return'
> into 'raise StopIteration' if it encounters it inside a generator,
> and into a regular return otherwise.

Yes.  The part about analyzing the return value inside gen_iternext() would
be the only change from the status quo.

> Why would you ask for the patch Just provided, and then change it back ?

I wouldn't.  I asked *you* for a patch (which I haven't yet applied, but
will) in a different area, but Just's patch was his own initiative.  I
hesitated on that one for reasons beyond just lack of time to get to it, and
I'm still reluctant to accept it.  My msg sketched an alternative to that
patch.  Note that Just has also (very recently) sketched another
alternative, but on the Iterators list instead.

    y'rs  - tim