gc.garbage from paramiko

John A Meinel john at arbash-meinel.com
Thu Feb 9 12:30:13 GMT 2006


Robey Pointer wrote:
> 
> On 7 Feb 2006, at 17:17, Andrew Bennetts wrote:
> 

...

>> In some cases it can be possible to replace __del__ with weakref
>> callbacks
>> (which don't have this problem), although I can't say whether that's a
>> possibility here without understanding what you're using __del__ for :)
> 
> [omitted clever tricks which I saved because they're pretty cool]
> 
> It doesn't look like I can use either the weakref callback (which I
> didn't know about till today) or the trick of adding a __del__ to a
> member variable, because in the destructor I'll need to effectively call
> "close()" on the destroyed object, which won't be available from either
> place.
> 

You could move the close() into the member variable. And then
main_obj.close() just calls the main_obj._secret_sauce.close().

It just depends what needs to happen.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060209/9021be44/attachment.pgp 


More information about the bazaar mailing list