python - why the value of lambda_var is changing? -
# sieve of eratosthenes? trial division? , python 3.6, pycharm 2017.1 def _odd_iter(): n = 1 while true: n += 2 yield n def primes(): yield 2 = _odd_iter() while true: num = next(it) yield num abc = num f_inner = lambda lambda_var: lambda x: x % lambda_var > 0 # lambd_var here f_outter = f_inner(abc) = filter(f_outter, it) = 0 nx1 in primes(): += 1 if <= 100: print(i, nx1, sep="#\t") else: break
while tried watch value of "lambda_var" breakpoint set line, found chaning minimal max in every loop, , thing it's not quite normal. wanna know, why?
e.g.:step step:
steps num abc lambda_var 1 3 3 undef 2 undef undef 3 3 5 5 undef 4 undef undef 5 5 undef undef 3 6 undef undef 5 7 7 7 undef 8 undef undef 7 9 undef undef 3 10 undef undef 5 11 undef undef 7 12 11 11 undef 13 undef undef 11 14 undef undef 3 15 undef undef 5 16 undef undef 7 17 undef undef 11 18 13 13 undef 19 undef undef 13 20 undef undef 3 21 undef undef 5 22 undef undef 7 23 undef undef 11 24 undef undef 13
Comments
Post a Comment