A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-January/060086.html below:

[Python-Dev] yield back-and-forth?

[Python-Dev] yield back-and-forth? [Python-Dev] yield back-and-forth?Morel Xavier xavier.morel at masklinn.net
Fri Jan 20 20:14:22 CET 2006
Christian Tanzer wrote:
> How about:
> 
>   def main_generator():
>       ...
>       yield * sub_generator()
> 
> Ducking-ly yrs,
> 

I like that one, but I'd stick the star to the generator (e.g. yield 
*sub_generator), the meaning being to "unpack" the generator into the 
yield, same as unpacking a sequence passed as function parameters.

As an extension, the syntax may even (though I'm not sure it'd be a good 
idea to do so) work with any iterable, behaving the same way (yielding 
the successive values of the iterable object)
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