Python 3.12.0
发布日期: 2023 年 10 月 2 日
这是 Python 3.12.0 的稳定版本
Python 3.12.0 是 Python 编程语言的最新主要版本,它包含许多新特性和优化。
与 3.11 相比,3.12 系列的主要新特性
新特性
- 更灵活的 f 字符串解析,允许许多以前不允许的操作 (PEP 701)。
- 在 Python 代码中支持缓冲协议 (PEP 688)。
- 一个新的调试/性能分析 API (PEP 669)。
- 支持具有独立全局解释器锁的隔离子解释器 (PEP 684)。
- 更加改进的错误消息。更多可能由拼写错误引起的异常现在会向用户提出建议。
- 支持 Linux
perf
性能分析器,在跟踪中报告 Python 函数名称。 - 许多大大小小的性能改进 (如 PEP 709 和对 BOLT 二进制优化器的支持),预计整体性能提升 5%。
类型注解
- 用于泛型类的新类型注解语法 (PEP 695)。
- 用于方法的新override 装饰器 (PEP 698)。
弃用
- 根据 PEP 623,已删除 Unicode 对象的 C 实现中已弃用的
wstr
和wstr_length
成员。 - 在
unittest
模块中,删除了一些长期弃用的方法和类。(它们自 Python 3.1 或 3.2 起已被弃用)。 - 已删除弃用的
smtpd
和distutils
模块(请参阅 PEP 594 和 PEP 632)。setuptools
包继续提供distutils
模块。 - 删除了一些其他旧的、损坏的和已弃用的函数、类和方法。
- 字符串中无效的反斜杠转义序列现在会发出
SyntaxWarning
而不是DeprecationWarning
,使其更明显。(它们在将来会成为语法错误。) - 为了提高性能,整数的内部表示已更改。(这不应影响大多数用户,因为它是一个内部细节,但可能会导致 Cython 生成的代码出现问题。)
有关 Python 3.12 更改的更多详细信息,请参阅 Python 3.12 中的新功能。
更多资源
- 在线文档.
- PEP 693,Python 3.12 发布计划。
- 通过 GitHub Issues 报告错误。
- 帮助资助 Python 及其社区.
现在来点完全不同的
They have no need of our help
So do not tell me
These haggard faces could belong to you or me
Should life have dealt a different hand
We need to see them for who they really are
Chancers and scroungers
Layabouts and loungers
With bombs up their sleeves
Cut-throats and thieves
They are not
Welcome here
We should make them
Go back to where they came from
They cannot
Share our food
Share our homes
Share our countries
Instead let us
Build a wall to keep them out
It is not okay to say
These are people just like us
A place should only belong to those who are born there
Do not be so stupid to think that
The world can be looked at another way
(now read from bottom to top)
难民,作者 Brian Bilston。
文件
版本 | 操作系统 | 描述 | MD5 校验和 | 文件大小 | GPG | Sigstore | |
---|---|---|---|---|---|---|---|
Gzip 压缩源代码 tarball | 源代码发行版 | d6eda3e1399cef5dfde7c4f319b0596c | 25.9 MB | SIG | .sigstore | ||
XZ 压缩源代码 tarball | 源代码发行版 | f6f4616584b23254d165f4db90c247d6 | 19.6 MB | SIG | .sigstore | ||
macOS 64 位 universal2 安装程序 | macOS | 适用于 macOS 10.9 及更高版本 | eddf6f35a3cbab94f2f83b2875c5fc27 | 43.3 MB | SIG | .sigstore | |
Windows 安装程序(64 位) | Windows | 推荐 | 32ab6a1058dfbde76951b7aa7c2335a6 | 25.3 MB | SIG | .sigstore | |
Windows 安装程序(32 位) | Windows | de59862985bf7afa639f2e4f9e2a722c | 24.0 MB | SIG | .sigstore | ||
Windows 安装程序 (ARM64) | Windows | 实验性 | 230c703e3b8b3d92765d118afa7b2f78 | 24.5 MB | SIG | .sigstore | |
Windows 可嵌入软件包(64 位) | Windows | 8e24d2b26a8dbf1da0694b9da1a08b2c | 10.5 MB | SIG | .sigstore | ||
Windows 可嵌入软件包(32 位) | Windows | c2047dc270c4936f9c64619bb193b721 | 9.4 MB | SIG | .sigstore | ||
Windows 可嵌入软件包 (ARM64) | Windows | 3da91ef1a86a8a210a32ea99c709dd93 | 9.8 MB | SIG | .sigstore |