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
[EMAIL PROTECTED]
> My questions are:
> 1) under normal conditions (no exceptions) is there a guarantee, that
> __del__ of
> all instruments is called at the end of measurement()?
>
> 2) if an exception is thrown, will all instruments be deleted if the
> error
> occurs in run() ?
> (only the instru
[EMAIL PROTECTED] wrote:
> 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).
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
[EMAIL PROTECTED] wrote:
> 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 experime