Message366933
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 statement is equivalent to this:
result = yield (yield 0)
This yields two values to the consumer: a `0` from the inner yield, followed by a None (or whatever was "sent" into the generator, if applicable) for the out yield.
In version 2, the corresponding line simplifies to just
result = yield 0
So no, I don't think these two versions of the code should behave the same, and I don't think there's any bug here. |
|
Date |
User |
Action |
Args |
2020-04-21 17:58:22 | mark.dickinson | set | recipients:
+ mark.dickinson, xsmyqf |
2020-04-21 17:58:22 | mark.dickinson | set | messageid: <1587491902.84.0.422260134352.issue40354@roundup.psfhosted.org> |
2020-04-21 17:58:22 | mark.dickinson | link | issue40354 messages |
2020-04-21 17:58:22 | mark.dickinson | create | |
|