# Pastebin 1VOgaOiX import gc open('foo', 'wb').write(b'hello') print(open('foo', 'rb').read()) class Foo: def __del__(self): print('garbage collected') Foo() gc.collect()