examples/advanced/destructor.py
class Destruct(object):
    def __init__(self):
        print('__init__')
    def __del__(self):
        print('__del__')
 
def main():
    a = Destruct()
    print('in main - after')

main()
print('after main')


examples/advanced/destructor.out
__init__
in main - after
__del__
after main