New submission from xie <xsm...@qq.com>: ----------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("--------------") ----------version2-------------- 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("--------------") ------------------problem------------------------ I think two version should behave same,but it did not.Do this will be treated as a bug ? ---------- messages: 366931 nosy: xsmyqf priority: normal severity: normal status: open title: problem when using yield type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40354> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com