uasyncio.core: Implement EventLoop.create_task(), new method in Python 3.4.2.

This method allows to schedule a coroutine in a loop without confusing globals
like async() or Task().
pull/11/head
Paul Sokolovsky 2014-11-04 02:49:44 +02:00
rodzic e9c7fa43f4
commit acbc5e462f
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -16,6 +16,11 @@ class EventLoop:
def time(self):
return time.time()
def create_task(self, coro):
# CPython 3.4.2
self.call_at(0, callback)
# CPython asyncio incompatibility: we don't return Task object
def call_soon(self, callback, *args):
self.call_at(0, callback, *args)