Python 3.9.1 版本于 2020-12-07 发布,是 Python 编程语言目前最新的 Python 3.9 版本,它包含了很多新特性和优化。自 3.9.0 版以来,我们已经进行了 282 次更改,提交了大量更新。相比之下,从3.8.0 到 3.8.1 版本只有 192 次提交。
安装支持
3.9.1 是第一个支持 macOS 11 Big Sur 的 Python 版本。使用 Xcode 11 及其以后的版本可以构建在 Apple Silicon 上运行的 Universal 2 二进制文件。Python 提供支持 macOS 11.0 的安装程序。该安装程序在 OS X 10.9 以后的版本都可以部署安装,pip 的版本还在更新中。
这是 Windows 上默认为64位安装程序的 Python 的第一个版本。Python 3.9 不再支持 Windows 7。
跟 3.8 比较,3.9 主要新特性
Python 3.9中的一些新的主要新功能和更改包括:
Module State Access from C Extension Methods
Union Operators in dict
Type Hinting Generics In Standard Collections
Flexible function and variable annotations
Python adopts a stable annual release cadence
Relaxing Grammar Restrictions On Decorators
Support for the IANA Time Zone Database in the Standard Library
String methods to remove prefixes and suffixes
New PEG parser for CPython
garbage collection does not block on resurrected objects;
os.pidfd_open added that allows process management without races and signals;
Unicode support updated to version 13.0.0;
when Python is initialized multiple times in the same process, it does not leak memory anymore;
A number of Python builtins (range, tuple, set, frozenset, list, dict) are now sped up using PEP 590 vectorcall;
A number of Python modules (_abc, audioop, _bz2, _codecs, _contextvars, _crypt, _functools, _json, _locale, operator, resource, time, _weakref) now use multiphase initialization as defined by PEP 489;
A number of standard library modules (audioop, ast, grp, _hashlib, pwd, _posixsubprocess, random, select, struct, termios, zlib) are now using the stable ABI defined by PEP 384.
更多 Python 3.9 版本新特性和优化,请参见官方文档。
Apple M1是苹果公司第一款基于ARM架构的自研处理器单片系统(SoC),为麦金塔计算机产品线提供中央处理器。它搭载于MacBook Air (2020 年末)、Mac Mini (2020 年末)、MacBook Pro(13 英寸,2020 年)上。M1是首款用于个人电脑的5纳米芯片。苹果宣称该芯片在所有低功耗中央处理器产品中性能最佳,同时具有最佳的性能功耗比。