Unbound names in __del__

Torsten Bronger bronger at physik.rwth-aachen.de
Sat Jun 18 19:08:39 EDT 2005


Hallöchen!

"Terry Reedy" <tjreedy at udel.edu> writes:

> "Torsten Bronger" <bronger at physik.rwth-aachen.de> wrote:
>
> [...]
>
>> However, this doesn't close sessions while the program is
>> running.  If the programmer has the above code in a function
>> which is called repeatedly, he may run into trouble.  IIRC my
>> current VISA DLL has only 256 session slots.
>
> Deleting during a run is a different issue from deleting during
> program shutdown, which is where you started us.

Well, I talked about shutdown in the OP because only *then* I had
experienced problems.  Cleaning up is important in every phase of
the program, though.

> [...]  So an explicit close is the only dependable
> cross-implementation method that I know of.

I agree, but I could live with the little danger of a Python
implementation that frees so slowly that the DLL runs out of
handles.  One could add a close() method for emergency use.
However, this __del__ thingy is so damn tempting ...  ;-)

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus



More information about the Python-list mailing list