[Python-ideas] Fast context creation
Stefano Borini
stefano.borini at ferrara.linux.it
Thu Nov 27 15:24:13 CET 2014
On Thu, Nov 27, 2014 at 11:30:40PM +1100, Chris Angelico wrote:
> You could abuse try/finally for this purpose.
>
> try:
> whatever you need to do
> finally:
> my_widget.setFocus()
I thought about this solution, but I am concerned about communication of intent. Using the try
communicates to a code reader that the code inside is expected to throw, which is not the case.
However, I agree there are good alternative strategies.
More information about the Python-ideas
mailing list