def __getitem__(self, attr): self.lock() try: val = list.__getitem__(self, attr) finally: self.unlock() return val