A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2014-November/137206.html below:

[Python-Dev] Please reconsider PEP 479.

[Python-Dev] Please reconsider PEP 479. [Python-Dev] Please reconsider PEP 479.Hrvoje Niksic hrvoje.niksic at avl.com
Wed Nov 26 16:55:27 CET 2014
On 11/26/2014 12:24 PM, Nick Coghlan wrote:
> Now needs to be written out explicitly as:
>
>      def my_generator():
>          ...
>         try:
>              yield next(it)
>          except StopIteration
>              return
>          ...

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
     ...

In general, catching and raising StopIteration feels like something that 
should rarely be done by normal code.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4