注意: 虽然 JavaScript 对于本网站不是必需的,但您与内容的互动将受到限制。请开启 JavaScript 以获得完整的体验。

Python 3.12.0b1

发布日期:2023 年 5 月 22 日

这是 Python 3.12 的 Beta 预览版

Python 3.12 仍在开发中。此版本 3.12.0b1 是 3.12 四个 Beta 预览版中的第一个。

Beta 预览版旨在让更广泛的社区有机会测试新功能和错误修复,并准备他们的项目以支持新的功能发布。

我们强烈鼓励第三方 Python 项目的维护者在 Beta 阶段使用 3.12 进行测试,并尽快将发现的问题报告到 Python Bug 追踪器。虽然该版本计划在进入 Beta 阶段时功能齐全,但在发布候选阶段(2023 年 7 月 31 日,星期一)开始之前,功能可能会被修改,在极少数情况下甚至会被删除。我们的目标是在 Beta 4 之后没有 ABI 更改,并在第一个发布候选版本 3.12.0rc1 之后尽可能减少代码更改。为此,在 Beta 阶段尽可能多地暴露 3.12 将极其重要

请记住,这是一个预览版本,建议在生产环境中使用。

与 3.11 相比,3.12 系列的主要新功能

Python 3.12 的一些主要新功能和变化包括

  • 泛型类的新类型注解语法 (PEP 695)。
  • 更灵活的 f-string 解析,允许以前许多不允许的情况 (PEP 701)。
  • 进一步改进的错误消息。现在,更多可能由拼写错误引起的异常会向用户提出建议。
  • 许多大大小小的性能改进(如 PEP 709)。
  • 支持 Linux perf 性能分析器在跟踪中报告 Python 函数名称。
  • 根据 PEP 623,unicode 对象的 C 实现中已弃用的 wstrwstr_length 成员已被移除。
  • unittest 模块中,一些长期弃用的方法和类已被移除。(它们自 Python 3.1 或 3.2 起就已被弃用)。
  • 已移除弃用的 smtpddistutils 模块(参见 PEP 594PEP 632)。setuptools 包(默认安装在虚拟环境和许多其他地方)继续提供 distutils 模块。
  • 许多其他旧的、损坏的和已弃用的函数、类和方法已被移除。
  • 字符串中无效的反斜杠转义序列现在会发出 SyntaxWarning 警告,而不是 DeprecationWarning,使其更加显眼。(它们将来会成为语法错误。)
  • 为准备性能增强,整数的内部表示已发生变化。(这不应影响大多数用户,因为它是一个内部细节,但可能会给 Cython 生成的代码带来问题。)
  • (嘿,核心开发者们,如果你们认为重要的功能没有出现在这个列表中,请告知 Thomas。)

有关 Python 3.12 更改的更多详细信息,请参阅 Python 3.12 新功能。Python 3.12 的下一个预发布版本将是 3.12.0b2,目前计划于 2023 年 5 月 29 日发布。

更多资源

接下来是些完全不一样的内容

由于第一个 Beta 版本标志着我们从主开发分支分支出发布分支的时刻,这里有一首关于“人生岔路口”的诗。

Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear;
Though as for that the passing there
Had worn them really about the same,

And both that morning equally lay
In leaves, no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I I took the one less traveled by,
And that has made all the difference.

罗伯特·弗罗斯特 的《未选择的路》。

文件

版本 操作系统 描述 MD5 校验和 文件大小 Sigstore GPG
Gzip 压缩的源码包 源码发布版 3b238c6ad8e78ca5976e2b886f022ba5 25.4 MB .sigstore SIG
XZ 压缩的源码包 源码发布版 859c31013d05bbd613eea39cdebdaf19 19.1 MB .sigstore SIG
macOS 64 位 universal2 安装程序 macOS 适用于 macOS 10.9 及更高版本 7191413092c47af5e9c9bfe27064f32f 41.8 MB .sigstore SIG
Windows 安装程序 (64位) Windows 推荐 d660b15757c5b668f9f6e3fbedb485c1 24.5 MB .sigstore SIG
Windows 安装程序 (32位) Windows 3a893f91ecf90b5e21227197030d53d9 23.3 MB .sigstore SIG
Windows 安装程序 (ARM64) Windows 实验性 7423739e6aac4c4058d0f0514896e5fc 23.7 MB .sigstore SIG
Windows 可嵌入包 (64位) Windows a33f890d3f7f7a6bf82932c50304de2f 9.9 MB .sigstore SIG
Windows 可嵌入包 (32位) Windows a17db347993eca977e9dca827d6556fe 8.9 MB .sigstore SIG
Windows 可嵌入包 (ARM64) Windows 7553a104f5e8390a6d0680c3e24f1b08 9.3 MB .sigstore SIG