Search found 6 matches

by klauweg
Fri Oct 18, 2019 6:04 am
Forum: Programs, Libraries and Tools
Topic: nested coros with uasync
Replies: 3
Views: 519

Re: nested coros with uasync

ok, reading https://github.com/peterhinch/micropyth ... HE_HOOD.md makes it clearer again.
by klauweg
Thu Oct 17, 2019 7:28 pm
Forum: Programs, Libraries and Tools
Topic: nested coros with uasync
Replies: 3
Views: 519

Re: nested coros with uasync

Thank you Peter for your effort. There are two ways to start a coro: via loop.create_task() or via await . In the first case the coro runs independently, in the second the coro that started it pauses until the dependent coro finishes. Hm, i thought "await" of something like "give control back to the...
by klauweg
Thu Oct 17, 2019 11:36 am
Forum: Programs, Libraries and Tools
Topic: nested coros with uasync
Replies: 3
Views: 519

nested coros with uasync

Hello, I've tried to implement a supervisor() coro that decides which other coros to call. But the varying delays should be implemented in the nested coros. So this was my first idea: async def starchaser(): while True: print("star!") await asyncio.sleep_ms(200) async def supervisor(): while True: p...
by klauweg
Sat Oct 12, 2019 4:52 pm
Forum: Programs, Libraries and Tools
Topic: @asyncio.coroutine vs async def
Replies: 5
Views: 844

Re: @asyncio.coroutine vs async def

Thank you jimmo,
that makes something clear.
by klauweg
Sat Oct 12, 2019 9:27 am
Forum: Programs, Libraries and Tools
Topic: @asyncio.coroutine vs async def
Replies: 5
Views: 844

Re: @asyncio.coroutine vs async def

Thank you Peter, for your quick reply. Of course i've already found your helpful tutorial. Nevertheless there are many questions. But that's not your fault. I'm quite new to python and this asyncio stuff in particular. Hm, i've found this in uasyncio core: def coroutine(f): return f As far as i unde...
by klauweg
Fri Oct 11, 2019 3:34 pm
Forum: Programs, Libraries and Tools
Topic: @asyncio.coroutine vs async def
Replies: 5
Views: 844

@asyncio.coroutine vs async def

Is there any practical difference between using the @asyncio.coroutine decorator and async keyword before def function?