cleaner way to write this?

John Salerno johnjsal at NOSPAMgmail.com
Wed Oct 25 16:54:07 EDT 2006


Paul Rubin wrote:
> John Salerno <johnjsal at NOSPAMgmail.com> writes:
>> Interesting idea to use try/finally to ensure that dlg.Destroy() runs
>> even with a return earlier in the method. 
> 
> Note that the code is wrong, the dialog should either be created
> outside the while loop, or destroyed inside it.  I don't know wx so
> I'm not sure which of those is correct.  But the version I posted
> potentially creates multiple dialogs and destroys only one of them.

oh you're right...seems like it will happen if the error occurs....



More information about the Python-list mailing list