摘要:
安装 pip install numba 使用示例 import time from numba import jit # 原始函数 def python_sum(n): total = 0 for i in range(n): total += i return total # Numba 加速版 阅读全文
posted @ 2025-09-18 14:39
CJTARRR
阅读(25)
评论(0)
推荐(0)
摘要:
作用 缓存不同参数组合的计算结果,命中缓存可以直接返回结果。 使用示例 import time from functools import lru_cache @lru_cache(maxsize=128) # 指定128个不同参数组合的调用结果,lru策略,设置为None表示无上限 def tes 阅读全文
posted @ 2025-09-18 14:11
CJTARRR
阅读(7)
评论(0)
推荐(0)
摘要:
安装rich库 pip install rich 使用示例 from rich.pretty import pprint as rich_print app_env = "prod" # 环境标识 dev_env = {"dev", "test"} # 开发/测试环境标识 def mprint(*a 阅读全文
posted @ 2025-09-18 13:40
CJTARRR
阅读(17)
评论(0)
推荐(0)
浙公网安备 33010602011771号