I think it was a bit of a timing thing. IIRC WarriorOfWire did the work to turn the keywords on before we had done the big merge from 1.9.4ish up to 1.15 (and we've merged 1.16 in now too.) I'm happy to review changes to turn on uasyncio but I may push to make it CPython compatible if it isn't (I haven't looked.) That's why we have a generator/coroutine distinction in our implementation. We didn't want folks to write non-cpython compatible async code by mixing coroutine and generator use.kevinkk525 wrote: ↑Mon Jul 19, 2021 7:30 amlol ok.. interesting. Why didn't they just use the "official" uasyncio module? .. (sorry I know you're not the right person for this question)
uasyncio - determining if a function is a coroutine
Re: uasyncio - determining if a function is a coroutine
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: uasyncio - determining if a function is a coroutine
ok thanks for the info. The current uasyncio implementation is CPython compatible almost everywhere because this time it was a basic requirement to be CPython compatible. But it does not distinguish between a coroutine and a generator.
But from the top of my head I can't think of how someone would accidentally mix generator and coroutine usage. Maybe my imagination is not good enough
But from the top of my head I can't think of how someone would accidentally mix generator and coroutine usage. Maybe my imagination is not good enough
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: uasyncio - determining if a function is a coroutine
uasyncio V3 supports asyncio syntax. Writing portable code is very easy. uasyncio does have some microcontroller oriented extensions such as sleep_ms(). By contrast tasko is just weird with syntax like
I've worked with (and written) schedulers for many years. I've never seen it done this way and I think I know why...
I strongly recommend uasyncio V3: it is excellent.
Code: Select all
tasko.schedule(hz=100, coroutine_function=rotary.loop)
I strongly recommend uasyncio V3: it is excellent.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.