def close(self):
    print('close() called.')

def test(self):
    print('test() called.')
if __name__ == '__main__':
    with Foo() as foo:
        print('with block begin???')
print('with block end???')
print(('foo:', foo))
Why is __del__ called at the end of a with block?