Figure 1. 使用 prompt_toolkit multi column autocompletion 功能做出 interactive command line tool. 目標與結論 本文的目標是想要在 command line 做到可以互動式選擇、展開有階層關係的文字列表工具。 使用 prompt_toolkit 的 autocompletion 功能,以及 prompt_toolki …
標籤: python
The target of IOTA-Python is to create a pure Python implementation of IOTA node. Now it can read out the data from IRI rocksdb without IRI RESTful API! …
random – 產生偽隨機亂數 This module implements pseudo-random number generators for various distributions. 官方介紹文件:9.6. random — Generate pseudo-random numbers 如果要產生亂數密碼或是 token,請使用 secrets 模組,絕對不要使用 rand …
sys — 系統相關的參數以及函式 This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available. 官方介紹文件:29.1 s …
CPython’s garbage collection relies on each object’s reference count. Each object has their own reference count, when the object is referenced by others, then we will need to increase objec …
本文將會探討 Python 內部的 Global Interpreter Lock,以及學習其如何影響 multi-threaded 程式。 原作者:A. Jesse,Twitter: @jessejiryudavis 原文:Grok the GIL: How to write fast and thread-safe Python Louie Lu 經作者同意[1][2]翻譯為正體中文。 當我6 …
不論是 setuptools 或是 distutils 都無法直接設定 C Extension package 的 version,必須採用紆迴的方式進行。 總而言之,Python 3.6 的年代,我們直接使用 setuptools。 0. 預期結果 [crayon-6422acf184b28703965573/] 1.原始狀況 原始 Init function: [crayon-6422acf18 …
Extending Python with C – Jump Consistent Hash 本文的目標是以 C 完成 Jump Consistent Hash 的主體,接著透過 Python-C-API 轉為 Python 可以使用的套件。也就是說,模組的本體將會以 C 語言寫成,接著透過 setuptools 編譯為 so 檔,如此編成的模組將可以讓 Python 無縫接軌使用。 參 …