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.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/63VEAJCXRA7MODB57JOCIPNGXXCIAML3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to