Daniel Moisset writes:

 > For the likely rare situation where I'd want to do this rather than
 > refactoring into a function, I might try with something like this without
 > requiring changes to the language:

 > @contextmanager
 > def breakable():

Of course this doesn't address Serhiy's case where he cares about the
performance hit of the try, but it sure looks nicer than some of the
other alternatives!
_______________________________________________
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/W73VBWL3AHUT4Y7MMD6HHJTIYTNKBQZC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to