标签:sum 分析 github 代码 prompt ota output span install
Github:https://github.com/lotapp/PySnooper
pip install pysnooper
使用:分析整个代码
@pysnooper.snoop()
def avg(args):
return sum(args) / len(args)
PS:调试代码片段
with pysnooper.snoop():
code
import functools
import pysnooper
# 分析整个代码
@pysnooper.snoop()
def sum(args):
return functools.reduce(lambda x, y: x + y, args)
def avg(args):
# return sum(args) / len(args)
sum_num = sum(args)
# 分析片段代码
with pysnooper.snoop():
avg_num = sum_num / len(args)
return avg_num
# 求和
sum(list(range(1, 101)))
# 平均值
avg(list(range(1, 101)))
标签:sum 分析 github 代码 prompt ota output span install
原文地址:https://www.cnblogs.com/dotnetcrazy/p/10848257.html