Hallöchen!
"Terry Reedy" <[EMAIL PROTECTED]> writes:
> "Torsten Bronger" <[EMAIL PROTECTED]> 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. IIR
"Torsten Bronger" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> Torsten Bronger wrote:
>>
>>> keithley = GpibInstrument(14)
>>> keithley.write("*IDN?")
>>> print keithley.read()
>>> A keithley.close() would be a wart in my opinion; instead I want
>>> to hide the whol
Torsten Bronger wrote:
>>Torsten Bronger wrote:
>>>keithley = GpibInstrument(14)
>>>keithley.write("*IDN?")
>>>print keithley.read()
>>
[on using atexit]
> However, this doesn't close sessions while the program is running.
> If the programmer has the above code in a function which is ca
Peter Hansen <[EMAIL PROTECTED]> writes on Fri, 17 Jun 2005 08:43:26 -0400:
> ...
> And I don't recall the last time I saw a __del__ in third-party code I
> was examining.
>
>
> What's your use case for del?
I had to use one a few days ago:
To call the "unlink" method of a "minidom" object
Hallöchen!
Peter Hansen <[EMAIL PROTECTED]> writes:
> Torsten Bronger wrote:
>
>> keithley = GpibInstrument(14)
>> keithley.write("*IDN?")
>> print keithley.read()
>>
>> A keithley.close() would be a wart in my opinion; instead I want
>> to hide the whole session thing from the progra
Torsten Bronger wrote:
> keithley = GpibInstrument(14)
> keithley.write("*IDN?")
> print keithley.read()
>
> A keithley.close() would be a wart in my opinion; instead I want to
> hide the whole session thing from the programmer. Besides, I
> haven't yet given up the hope that the issu
Hallöchen!
Peter Hansen <[EMAIL PROTECTED]> writes:
> Torsten Bronger wrote:
>
>> Peter Hansen <[EMAIL PROTECTED]> writes:
>>
>>> What's your use case for del?
>>
>> Every instance represents a "session" to a measurement instrument.
>> After the instance is deleted, the session should be closed t
Torsten Bronger wrote:
> Peter Hansen <[EMAIL PROTECTED]> writes:
>>What's your use case for del?
>
> Every instance represents a "session" to a measurement instrument.
> After the instance is deleted, the session should be closed to free
> resources.
You mean like GPIB devices? We've written a
Hallöchen!
Peter Hansen <[EMAIL PROTECTED]> writes:
> [...]
>
> What's your use case for del?
Every instance represents a "session" to a measurement instrument.
After the instance is deleted, the session should be closed to free
resources.
If the program exists, this is actually not necessary,
Torsten Bronger wrote:
> However, all of this is not pretty pythonic in my opinion. Is it
> that exotic to want to call functions from within __del__?
Yes, I think it probably is. In the few hundred thousand lines of
Python code I've played a role in developing, we've used __del__ once,
to my
Torsten Bronger wrote:
> When my __del__ methods are called because the program is being
> terminated, I experience difficulties in calling functions that I
> need for a clean shutdown of my instances. So far, there has been
> only one of these functions, and a class-local alias solved the
> prob
Hallöchen!
"Terry Reedy" <[EMAIL PROTECTED]> writes:
> "Torsten Bronger" <[EMAIL PROTECTED]> wrote:
>
>> Is there a way to detect whether the program is being terminated?
>
> See atexit module to register cleanup functions that run *before*
> the interpreter starts haphazardly deleting stuff.
So
"Torsten Bronger" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>Is there a way to detect whether the program is being terminated?
See atexit module to register cleanup functions that run *before* the
interpreter starts haphazardly deleting stuff.
Terry J. Reedy
--
http://ma
Hallöchen!
When my __del__ methods are called because the program is being
terminated, I experience difficulties in calling functions that I
need for a clean shutdown of my instances. So far, there has been
only one of these functions, and a class-local alias solved the
problem. However, now the
14 matches
Mail list logo