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