cspotcode / cspotcode/py_game_coroutines
Support async/await syntax
- Dominant language
- Python
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
`async def ` is more explicit and obvious for declaring a coroutine than a normal `def` with yield statements inside it.
`await other_coroutine()` is a bit nicer than `yield from`
Cons:
users might get confused and believe (incorrectly) that this behaves like asyncio stuff, or that they can use stuff like asyncio.sleep()
---
To support async/await, the context helpers need to return values that are both generators and awaitable. Currently they return generators.
A wrapper like this might work:
```python
class AwaitableGenerator:
def __init__(self, generator):
self._g = generator
def __await__(self):
return self._g
def __iter__(self):
return self._g
```
Contributor guide
Assessment
This issue has not been assessed yet.