[Python-Dev] PEP Idea: Syntactic sugar for StopIteration.

Tristan Seligmann mithrandi-python-dev at mithrandi.za.net
Sun Dec 9 04:35:01 CET 2007


* Phillip J. Eby <pje at telecommunity.com> [2007-12-08 20:19:29 -0500]:

> At 07:55 PM 12/8/2007 -0500, Manuel Alejandro Cerón Estrada wrote:
> >2007/12/8, Greg Ewing <greg.ewing at canterbury.ac.nz>:
> > > I would put it the other way around -- the problem
> > > that 'yield break' is meant to solve is already solved
> > > by 'return'. So there's no need for change.
> >
> >I have been re-thinking the problem and this is true. The only
> >exception would be empty generators, but they are rare.
> 
> Note that:
> 
>     def g():
>         return
>         yield

And this isn't a generator at all, but is almost the same:

    def h():
        return iter([])
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://mail.python.org/pipermail/python-dev/attachments/20071209/229b1868/attachment.pgp 


More information about the Python-Dev mailing list