指出老师的一处有问题的地方,请老师看看
Topic source按照老师文中敲,报这个错 [root@localhost ~]# python sushu.py 2 3 Traceback (most recent call last): File "sushu.py", line 17, in <module> for n in primes(): File "sushu.py", line 16, in primes it = filter(not_divisible(n),it) TypeError: not_divisible() takes 0 positional arguments but 1 was given
- 1
虚幽魂
def primes(): yield 2 it = _odd_iter() # 初始序列 while True: n = next(it) # 返回序列的第一个数 yield n it = filter(_not_divisible(n), it) # 构造新序列 **这个函数_not_divisible()里面不应该有n,会报错的……