Re: [Python-Dev] Please reconsider PEP 479.

2014年11月26日 08:18:11 -0800

On Thu, Nov 27, 2014 at 2:55 AM, Hrvoje Niksic <[email protected]> wrote:
> To retrieve a single value from an iterator, one can use the for/break/else
> idiom:
>
> def my_generator():
> ...
> for val in it:
> yield val
> break
> else:
> return
> ...
While that does work, it's not really much more "normal" than a
try/except. A for loop implies iteration; having a loop with a hard
"break" at the end of it messes with expectations.
ChrisA
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to