On Tue, Sep 10, 2013 at 11:43 AM, Anand B Pillai < anandpil...@letterboxes.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Tuesday 10 September 2013 11:30 AM, Anand B Pillai wrote: > > > Don't advise anyone to use this code - it is just to illustrate > > the one of the ways in which weak references can be used. In > > general it is better not to rely on the order of gc in your code > > to implement a feature. > > Here is the code in pastebin - http://pastebin.com/wmLduVBh You can also achieve the same using __del__. class Foo: def __del__(self): print "on exit" foo = Foo() if __name__ == '__main__': print 3+4 print 8+9 _______________________________________________ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers