注意: 虽然 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 错误跟踪器报告发现的问题。 虽然该版本计划在进入 beta 阶段时完成所有功能,但在发布候选阶段开始之前(2023 年 7 月 31 日星期一),功能可能会被修改,或者在极少数情况下会被删除。 我们的目标是在 beta 4 之后不进行 ABI 更改,并在第一个发布候选版本 3.12.0rc1 之后尽可能少地进行代码更改。 为了实现这一目标,在 beta 阶段尽可能多地让 3.12 曝光将极其重要

请记住,这是一个预览版本,建议将其用于生产环境。

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

Python 3.12 中的一些主要新功能和更改包括

  • 用于泛型类的新类型注释语法(PEP 695)。
  • 更灵活的 f-字符串解析,允许许多以前不允许的事情(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-05-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 校验和 文件大小 GPG Sigstore
Gzip 压缩的源代码 tarball 源代码发布 3b238c6ad8e78ca5976e2b886f022ba5 25.4 MB SIG .sigstore
XZ 压缩的源代码 tarball 源代码发布 859c31013d05bbd613eea39cdebdaf19 19.1 MB SIG .sigstore
macOS 64 位 universal2 安装程序 macOS 适用于 macOS 10.9 及更高版本 7191413092c47af5e9c9bfe27064f32f 41.8 MB SIG .sigstore
Windows 安装程序(64 位) Windows 推荐 d660b15757c5b668f9f6e3fbedb485c1 24.5 MB SIG .sigstore
Windows 安装程序(32 位) Windows 3a893f91ecf90b5e21227197030d53d9 23.3 MB SIG .sigstore
Windows 安装程序(ARM64) Windows 实验性 7423739e6aac4c4058d0f0514896e5fc 23.7 MB SIG .sigstore
Windows 可嵌入包(64 位) Windows a33f890d3f7f7a6bf82932c50304de2f 9.9 MB SIG .sigstore
Windows 可嵌入包(32 位) Windows a17db347993eca977e9dca827d6556fe 8.9 MB SIG .sigstore
Windows 可嵌入包(ARM64) Windows 7553a104f5e8390a6d0680c3e24f1b08 9.3 MB SIG .sigstore