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/2005-October/057406.html below:

[Python-Dev] Coroutines, generators, function calling

[Python-Dev] Coroutines, generators, function callingNick Coghlan ncoghlan at gmail.com
Tue Oct 18 15:36:21 CEST 2005
Gustavo J. A. M. Carneiro wrote:
>   I don't suppose there could be a way to make the yield inside the
> subfunction have the same effect as if it was inside the function that
> called it?  Perhaps some special notation, either at function calling or
> at function definition?

You mean like a for loop? ;)

   def show_message(msg):
       win = create_window(msg)
       for step in animate(win, xrange(10)): # slide down
           yield step
       yield Timeout(3)
       for step in animate(win, xrange(10, 0, -1)): # slide up
           yield step
       win.destroy()

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.blogspot.com
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