![]() Generators are functions that yield values iteratively, like a list that's computed on demand. When paired with async syntax, generators can be used to concisely create functions that yield values when external conditions are met. Now Python 3.6 has extended async and await to work in two other major parts of Python: generators and comprehensions. Python 3.5 introduced asynchronous behavior to Python's syntax through the async and await keywords. The nitty-gritty: Earlier versions of Python allowed developers to build functions that could run asynchronously, without blocking each other, but not in a particularly elegant manner. ![]() Why: Processing that normally involves long delays, such as reading from a network socket, can now be done without holding up the rest of the app - and via syntax built into the language. What: With Python 3.6, the async and await keywords in Python can now be used inside generators and comprehensions, instead of simply to decorate functions.
0 Comments
Leave a Reply. |