Ah. Now I get the key point you were making about scope — that the `as <something>` variable is in the surrounding scope following the execution of the `with` block.
You're right. That really does already do pretty close to what I am asking for. It's just a hair short in that it requires an additional line to get the result out of the builder, but that's not enough of a big deal to make significant changes to the capabilities of context managers. _______________________________________________ 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/JMSYZXQUWKBM6F6YZDJMQ4PVR37BUXGI/ Code of Conduct: http://python.org/psf/codeofconduct/