view python/example/deldel.py @ 884:e5861cbbc4bb

python3
author Jeff Hammel <k0scist@gmail.com>
date Wed, 05 Aug 2020 09:45:27 -0700
parents d6f535ef4bdc
children
line wrap: on
line source

#!/usr/bin/env python

class Foo(object):
    def __call__(self, string):
        print string
    def __del__(self):
        print "Deleting"

foo = Foo()
foo("You will see deleting")
del foo

foo = Foo()
del Foo.__del__
foo("And now you won't")
del foo