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?
In case of sleep, sleep could be implemented to return a Future object. 2012/12/21 Laurens Van Houtven <_...@lvh.cc> > A generic comment on yield from APIs that I'm sure has been discussed in > some e-mail I missed: is there an obvious way to know up front whether > something needs to be yielded or yield frommed? In twisted, which is what > I'm used to it's all deferreds; but here a future's yield from but sleep's > yield? > > > > On Fri, Dec 21, 2012 at 8:09 PM, Guido van Rossum <gu...@python.org>wrote: > >> On Fri, Dec 21, 2012 at 11:06 AM, Jesse Noller <jnol...@gmail.com> wrote: >> > I really do like tulip as the name. It's quite pretty. >> >> I chose it because Twisted and Tornado both start with T. But those >> have kind of dark associations; I wanted to offset that with something >> lighter. (OTOH we could use a black tulip as a logo. :-) >> >> Regardless, it's not the kind of name we tend to use for the stdlib. >> It'll probably end up being asynclib or something... >> >> -- >> --Guido van Rossum (python.org/~guido) >> _______________________________________________ >> Python-ideas mailing list >> python-id...@python.org >> http://mail.python.org/mailman/listinfo/python-ideas >> > > > > -- > cheers > lvh > > _______________________________________________ > Python-ideas mailing list > python-id...@python.org > http://mail.python.org/mailman/listinfo/python-ideas > >
_______________________________________________ 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