Discuss / Python / 搞不懂

搞不懂

Topic source

JOIEUH

#1 Created at ... [Delete] [Delete and Lock User]

o = odd() next(o) step 1 1 next(o) step 2 3 next(o) step 3 5 next(o) Traceback (most recent call last): File "<stdin>", line 1, in <module> StopIteration

这个直接next(odd()) 无论多少次都是第一个没有变。 而next(o),却会不断下一个 按道理来说 o = odd() 他们的结果应该一样的

JOIEUH

#2 Created at ... [Delete] [Delete and Lock User]

不知道为什么变成这样,这代码就是上面的那个弄出 1,3,5 的那段代码


  • 1

Reply