On Fri, Dec 21, 2012 at 2:26 PM, Jonathan Slenders <jonat...@slenders.be> wrote: > As far as I understand, "yield from" will always work, because a Future > object can act like an iterator, and you can delegate your own generator to > this iterator at the place of "yield from". > "yield" only works if the parameter behind yield is already a Future object. > Right Guido?
Correct! Sounds like you got it now. That's the magic of yield from.. > In case of sleep, sleep could be implemented to return a Future object. It does; in tulip/futures.py: def sleep(when, result=None): future = Future() future._event_loop.call_later(when, future.set_result, result) return future -- --Guido van Rossum (python.org/~guido) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com