22.04.20 08:11, Greg Ewing пише:
I don't this should be a guarantee, in this or any similar situation. The only purpose for the value in a StopIteration is to provide a return value for yield-from when the thing being delegated to is a generator. If you're yielding from something that's not a generator, and not specifically designed to mimic one, then all bets are off.
Several years ago there was a discussion about extending itertools to support generators (passing throw the return value, supporting send() and throw(), etc). This idea was rejected at that time due to a lack of good use cases.
_______________________________________________ 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/C3GD5NRXUNFMULUBDV7C4JWQTXCKEZM4/ Code of Conduct: http://python.org/psf/codeofconduct/