Python 3.6 有什麼新功能

編輯者:

Elvis Pranskevichus <elvis@magic.io>, Yury Selivanov <yury@magic.io>

本文介紹了 Python 3.6 與 3.5 相比多了哪些新功能。Python 3.6 已於 2016 年 12 月 23 日發布。完整詳情請見 changelog

也參考

PEP 494 - Python 3.6 發佈時程

發布重點摘要

新增語法特性:

  • PEP 498, formatted string literals.

  • PEP 515, underscores in numeric literals.

  • PEP 526, syntax for variable annotations.

  • PEP 525, asynchronous generators.

  • PEP 530: asynchronous comprehensions.

新的函式庫模組:

CPython 實作改進:

標準函式庫中的顯著改進

  • The asyncio module has received new features, significant usability and performance improvements, and a fair amount of bug fixes. Starting with Python 3.6 the asyncio module is no longer provisional and its API is considered stable.