all AI news
[Python] A Journey to Python Async - 2. Generators as Iterators
July 15, 2023, 4:49 a.m. | UponTheSky
DEV Community dev.to
Why Generators?
As previously announced, our journey starts from the discussion about Python generators. But why? To recapitulate, let’s write a very simple async
function and see its execution result.
async def journey() -> None:
return 1
ret = journey()
print(type(ret))
<class 'coroutine'>
sys:1: RuntimeWarning: coroutine 'journey' was never awaited
Please ignore the warning for a bit. If it were a simple synchronous function(i.e. just the normal Python function), it would …
async coroutine function iterators journey network python simple type webdev
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
Founding AI Engineer, Agents
@ Occam AI | New York
AI Engineer Intern, Agents
@ Occam AI | US
AI Research Scientist
@ Vara | Berlin, Germany and Remote
Data Architect
@ University of Texas at Austin | Austin, TX
Data ETL Engineer
@ University of Texas at Austin | Austin, TX
Lead GNSS Data Scientist
@ Lurra Systems | Melbourne