A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2015-April/139481.html below:

[Python-Dev] PEP 3152 and yield from Future()

[Python-Dev] PEP 3152 and yield from Future() [Python-Dev] PEP 3152 and yield from Future()Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 24 03:05:45 CEST 2015
Yury Selivanov wrote:
> Another problem is functions that return future:
> 
> def do_something():
>     ...
>     return fut
> 
> With Greg's idea to call it you would do:
> 
>    cocall (do_something())()
> 
> That means that you can't refactor your "do_something"
> function and make it a coroutine.

There's no fundamental problem with a cofunction
returning another cofunction:

codef do_something():
    return fut

f = cocall do_something()
result = cocall f()

Combining those last two lines into one would
require some extra parenthesisation, but I don't
think that's something you're going to be doing
much in practice. If you're just going to
immediately call the result, there's no point
in returning a future -- just do it all in
do_something().

-- 
Greg
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