[MERGE] Add exit() on progressbars from TestUIFactory

Robert Collins robert.collins at canonical.com
Tue Mar 17 01:39:53 GMT 2009


On Tue, 2009-03-17 at 12:26 +1100, Martin Pool wrote:
> 
> Firstly, I saw in some existing code that while you cannot do
> try/finally in python2.4, you apparently can do
> 
> try:
>   stuff
> except e:
>   finish()
>   raise
> else:
>   finish()
> 
> ... which is so close to try/finally one really wonders why they
> thought it was impossible, but anyhow.  It does mean that you cannot
> just 'return' from inside the try block to finish the function, but
> rather you have to arrange to exit it through the bottom, and there is
> some risk of a bug if you forget to do so.
>
> This has the advantage that all the code to do with the pb is inside
> the generator function.

It has the disadvantage that it doesn't work :(.

Python simply fails to tell you that it won't.

-Rob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090317/fd6de427/attachment.pgp 


More information about the bazaar mailing list