1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import logging from autoclose import AutoClose class C(AutoClose): def __init__(self, id): self.id = id def close(self): logging.warn('closing object %s' % self.id) super(C, self).close() class D(C): pass if __name__ == '__main__': c1 = C(1) c2 = C(2) d3 = D(3)