Python 官网于 6 月 27 日发布 v3.7.0 的更新说明。v3.7.0 是最近比较大的更新。此次发布包含了诸多新特性和优化。
官网对新特性和优化的汇总:
新语法特性:
向后不兼容的语法更改:
async
和 await
现在是保留关键字新的库模块:
contextvars
: PEP 567 – Context Variablesdataclasses
: PEP 557 – Data Classes新的 built-in 特性:
breakpoint()
Python 数据模型改进:
标准库中的重要改进:
asyncio
module has received new features, significant usability and performance improvements. (asyncio 模块已经获得了新功能,显着的可用性和性能改进。)time
module gained support for functions with nanosecond resolution. (time 模块获得了对纳秒级分辨率功能的支持)CPython 实现的改进:
DeprecationWarning
handlingC API 改进:
文档改进:
其他详情,请参阅 Python 官网说明:
https://docs.python.org/3.7/whatsnew/3.7.html