pathlib – 物件導向的檔案系統路徑 This module offers classes representing filesystem paths with semantics appropriate for different operating systems. Path classes are divided between pure paths, which provi …
標籤: adayastdlib
透過 inspect 函式庫,我們可以探測幾乎任何的東西 (凡舉模組、類別、函式、traceback、frame 甚至是 code 的資訊!)。inspect 主要提供四大功能:型態檢查、獲取程式碼、探測類別與函式、檢查直譯器堆疊。 …
secrets 模組的用意,是為了要在 Python 內提供一個適用於密碼層級的亂數產生機制,透過 secrets 我們可以輕鬆的產生密碼強度的亂數以及亂數選擇元素,從而避免使用者使用 random 模組來產生隨機亂數並將之用於密碼上。 …
透過 tracemalloc 將可以記錄下 Python 的記憶體區塊配置狀況,同時透過這些記錄來輸出有用的記憶體配置資訊,例如說執行記憶體配置的檔案以及行數、記憶體區塊大小等。也可以透過比對兩個不同的記憶體區塊快照,來找出記憶體洩漏的問題。 …
Python atexit 套件用來註冊當程式結束時要執行的函式。被 atexit 註冊的函式,會在程式正常結束的時機點被執行。執行的順序為先註冊後執行 (First Register Last Execute)。 …
enum 是 Python 裏用來建立枚舉形態的標準函式庫。enum 算是比較新的標準函式庫,學習 enum 可以讓你輕鬆建立枚舉,改寫以前單獨使用 const variable 的狀況。 …
Python concurrent.futures 提供了一組高階 API 給使用者執行非同步的任務。透過 ThreadPoolExectuor 執行 thread 層級的非同步任務,或是使用 ProcessPoolExecutor 執行 process 層級的非同步任務。 …
linecache – Random access to text lines The linecache module allows one to get any line from a Python source file, while attempting to optimize internally, using a cache, the common case where ma …
weakref – Weak References The weakref module allows the Python programmer to create weak references to objects. 官方介紹文件:8.8. weakref — Weak references weakref 函式庫是用來建立對物件的弱引用 (weak reference)。弱引用並 …
abc — Abstract Base Classes This module provides the infrastructure for defining abstract base classes (ABCs) in Python, as outlined in PEP 3119; see the PEP for why this was added to Python. (See also …