[issue40354] problem when using yield

2020-04-21 Thread xie
xie added the comment: Okay,I agree with you.I did not get the priority. -- stage: -> resolved status: open -> closed ___ Python tracker ___ _

[issue40354] problem when using yield

2020-04-21 Thread Mark Dickinson
Mark Dickinson added the comment: Which part of the behaviour do you think is a bug? In version1, you want to think of the yield expression as though it were bracketed like this: result = yield (a+100 if b>100 else (yield a)) With the particular values of a and b that you have, that sta

[issue40354] problem when using yield

2020-04-21 Thread xie
New submission from xie : --version1:-- def func1(): a=0 b=10 for i in range(4): result = yield a+100 if b>100 else (yield a) print(result) f1 = func1() print("value:%s" % next(f1)) print("--") print("value:%s" % next(f1)) print("-