[Python-Dev] PEP 3152 and yield from Future() (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 24 03:05:45 CEST 2015
- Previous message (by thread): [Python-Dev] PEP 3152 and yield from Future()
- Next message (by thread): [Python-Dev] PEP 3152 and yield from Future()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Yury Selivanov wrote:
Another problem is functions that return future:
def dosomething(): ... return fut With Greg's idea to call it you would do: cocall (dosomething())() That means that you can't refactor your "dosomething" 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
- Previous message (by thread): [Python-Dev] PEP 3152 and yield from Future()
- Next message (by thread): [Python-Dev] PEP 3152 and yield from Future()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]