Re: Reliable destruction

2005-08-05 Thread Pierre-Eric . Melchy
Hello, your idea sounds good and handles the exception on teardown as well. (I did not think about the if XXX!=None check in teardown()) I will now provide each of the instruments with an explicit shutdown() method which frees the interface card as well. These methods will be called in a finally

Re: Reliable destruction

2005-08-04 Thread Pierre-Eric . Melchy
Hello Benjamin, What would happen if an exception was thrown in the middle of setup()? tearDown could not handle this case without having a list of the objects already constructed (Or I would have to rely on the automatic call to __del__, if it is reliable). There is still some problem: Imagine

Reliable destruction

2005-08-04 Thread Pierre-Eric . Melchy
Hello, I have a class measurement representing a physical measurement. Different objects in this class represent laboratory equipment, which might raise an exception (e.g. overtemperature). In any case the equipment has to be switched off after the experiment, since if a power supply stays in the