On Fri, May 28, 2021 at 4:49 AM Shreyan Avigyan email@example.com wrote:
Reply to Chris:
The only problem is that with that approach that we can't understand if that's the last yield statement. To achieve that we need to keep going until we encounter a StopIteration. And the value of x would 3. Because we're not iterating over a particular generator. We're creating multiple instances which actually would increase x.
And also is there another way we can make it thread safe? Steven's idea is actually the only solution we've encountered till now. I'd be really happy if someone could come up with even a better idea.
Also - Steven's idea is NOT a solution. It worsens the problem. I don't see how it is at all a solution.