我是Python的新手,我不断看到如下例子:
def max_wordnum(texts):
count = 0
for text in texts:
if len(text.split()) > count:
count = len(text.split())
return count
Run Code Online (Sandbox Code Playgroud)
迭代是否len(text.split())被Python中的解释器/编译器以某种方式进行了优化,或者这只需要两倍于存储len(text.split())在变量中的CPU周期?
python ×1