心心念念的Python3.7终于 release了。 :?:

官网对新特性和优化的汇总:

新语法特性:

  • PEP 563, postponed evaluation of type annotations.

向后不兼容的语法更改:

  • asyncawait 现在是保留关键字

新的库模块:

  • contextvars: PEP 567 - Context Variables
  • dataclasses: PEP 557 - Data Classes
  • importlib.resources

新的 built-in 特性:

  • PEP 553, 新函数 breakpoint()

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.

标准库中的重要改进:

  • The asyncio module has received new features, significant usability and performance improvements. (asyncio 模块已经获得了新功能,显着的可用性和性能改进。)
  • The time module gained support for functions with nanosecond resolution. (time 模块获得了对纳秒级分辨率功能的支持)

CPython 实现的改进:

  • Avoiding the use of ASCII as a default text encoding: 取消 ASCII 作为默认文本编码

    • PEP 538, legacy C locale coercion
    • PEP 540, forced UTF-8 runtime mode
  • PEP 552, deterministic .pycs

  • the new development runtime mode

  • PEP 565, improved DeprecationWarning handling

C API 改进:

  • PEP 539, new C API for thread-local storage

文档改进:

  • Python 官方文档的翻译,新增日文版、法语版和韩语版;

详见:https://docs.python.org/3.7/whatsnew/3.7.html