Python 3.7 有什麼新功能

編輯者:

Elvis Pranskevichus <elvis@magic.io>

本文介紹了 Python 3.7 與 3.6 相比多了哪些新功能。Python 3.7 已於 2018 年 6 月 27 日發布。有關完整詳細資訊,請參閱 changelog

發布重點摘要

新增語法特性:

  • PEP 563, postponed evaluation of type annotations.

Backwards incompatible syntax changes:

新的函式庫模組:

新的內建功能:

Python 資料模型改進:

  • PEP 562, customization of access to module attributes.

  • PEP 560, core support for typing module and generic types.

  • the insertion-order preservation nature of dict objects has been declared to be an official part of the Python language spec.

標準函式庫中的顯著改進

CPython 實作改進: