def __exit__(self, exc, value, tb):
    print('__exit__() called.')

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))
Почему __del__ вызывается в конце блока with?