注意: 雖然 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