Fredrik Lundh wrote:
> "flupke" wrote:
>
>
>>>Then i got a tip that you can register a function that needs to be
>>>called when the object is going to be deleted.
>>>For instance to register a function __exit, you do this:
>
>
>>>class line:
>>>def __init__(s,glob,argl,color=''):
>>>
>
> do you (or whoever gave you the tip) have the slightest idea what atexit does?
>
Yeah, I got the tip on this group. researched and found it was
for when program ends!
I was trying to treat it like a destructor. darn.
--
http://mail.python.org/mailman/listinfo/python-list
"phil" <[EMAIL PROTECTED]> wrote:
>> Then i got a tip that you can register a function that needs to be
>> called when the object is going to be deleted.
>> For instance to register a function __exit, you do this:
>
> Here is the complete line class with your suggestion:
>
> Below is the output.
>
"flupke" wrote:
>> Then i got a tip that you can register a function that needs to be
>> called when the object is going to be deleted.
>> For instance to register a function __exit, you do this:
>> class line:
>> def __init__(s,glob,argl,color=''):
>> atexit.register(s.__exit)
> I d
phil wrote:
>
>> Then i got a tip that you can register a function that needs to be
>> called when the object is going to be deleted.
>> For instance to register a function __exit, you do this:
>>
>
>
> Here is the complete line class with your suggestion:
>
> Below is the output.
>
> Nice id
> Then i got a tip that you can register a function that needs to be
> called when the object is going to be deleted.
> For instance to register a function __exit, you do this:
>
Here is the complete line class with your suggestion:
Below is the output.
Nice idea, maybe I did something wrong