[Tutor] Replacement for __del__

spir denis.spir at free.fr
Tue May 19 20:55:11 CEST 2009


Le Tue, 19 May 2009 19:27:16 +0100,
"Alan Gauld" <alan.gauld at btinternet.com> s'exprima ainsi:

> > def __del__(self):
> >    try:
> >        self.f.close()
> >    except:
> >        pass  
> 
> This is, I agree, pointless. but very different to:
> 
> def __ del__(self):
>      try:
>         os.remove(self.lockname)
>      except: pass
> 
> 
> Of course the question of whether using disk storage to indicate 
> object lifetime is a good design pattern is another issue altogether!

But there are many other (sensible) kinds of uses for temp storage on disk. Including some for the developper's own feedback.

Denis
------
la vita e estrany


More information about the Tutor mailing list