Python 3.5 adds async and await

Summary

Python 3.5 introduces native coroutine syntax, type annotations and matrix multiplication as important language and library extensions. Python 3.5 was released in September 2015.

Ideas

  • async def explicitly defines native coroutines.
  • await visibly marks interruptible asynchronous operations.
  • Type annotations support external checking tools without enforcing anything at run time.
  • The @ operator describes matrix multiplication.

Insights

  • Syntax can unify widespread library patterns.
  • Explicit suspension points make concurrent flows easier to understand.
  • Optional types improve tooling without forbidding dynamic use.

Facts

  • PEP 492 defined async and await.
  • PEP 484 standardised type annotations.

Recommendations

  • Propagate cancellation and timeouts through asynchronous call chains.
  • Introduce type checking gradually for stable interfaces.

References

Read the original article

Search the Web Archive

Found a mistake or have something to add? Get in touch.