[Python-Dev] Coroutines, generators, function calling
Nick 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