def __setitem__(self, attr, val): val = makeThreadsafe(val) self.lock() try: list.__setitem__(self, attr, val) finally: self.unlock()