This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson, xsmyqf
Date 2020-04-21.17:58:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587491902.84.0.422260134352.issue40354@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-04-21 17:58:22mark.dickinsonsetrecipients: + mark.dickinson, xsmyqf
2020-04-21 17:58:22mark.dickinsonsetmessageid: <1587491902.84.0.422260134352.issue40354@roundup.psfhosted.org>
2020-04-21 17:58:22mark.dickinsonlinkissue40354 messages
2020-04-21 17:58:22mark.dickinsoncreate