← index #14331Issue #14400
Off-topic · high · value 2.646
QUERY · ISSUE

Add yield support in async function

openby m24hopened 2024-04-19updated 2024-04-19
enhancement

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues regarding this feature, and didn't find any.

Description

Just in PEP 525, it's really easy to make a async generator instead of coding a new class with aiter and anext .

Just like this:

async def test():
   for i in range(5):
      await something
'     yield i

Code Size

I believe this is an important syntax that makes asynchronous generation as convenient as normal generators.

Implementation

  • I intend to implement this feature and would submit a Pull Request if desirable.
  • I hope the MicroPython maintainers or community will implement this feature.
  • I would like to Sponsor development of this feature.
CANDIDATE · ISSUE

[webassembly] element.onclick = async fn fails

closedby WebReflectionopened 2024-04-30updated 2024-05-01
bugport-webassembly

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues matching this bug, and didn't find any.

Port, board and/or hardware

webassembly PyScript port

MicroPython version

latest

Reproduction

async def thing(event):
    print(event)

element.onclick = thing

There's no way to have an async listener.

Expected behaviour

in JS and other runtimes, element.onclick = async_ref works, in MicroPython nothing happens ... async def(): are all ignored when assigned, either via run or runAsync utilities.

Observed behaviour

in JS and other runtimes, element.onclick = async_ref works, in MicroPython nothing happens ... async def(): are all ignored when assigned, either via run or runAsync utilities.

Additional Information

No, I've provided everything above.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied