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

Raymond Hettinger python at rcn.com
Sat Dec 8 20:17:28 CET 2007


> Note that 'yield break' resembles the 'break' statement used in loops,
> while 'StopIteration' doesn't. 'yield break' is more orthogonal to the
> rest of the language.
>
> I am looking forward to seeing your opinions.

-1

I do not find the meaning to be transparent and the proposal adds new syntax without adding functionality.

Also, I do not find the "emtpy generator" use case to be even slightly motivating.  If an empty iterator were needed for some 
reason, I would just write: iter([]) and be done with it.


Raymond 


More information about the Python-Dev mailing list