Clean way to disable `__setattr__` until after initialization
问题 I've written the following wrapper class. I want to define __setattr__ such that it redirects all attributes to the wrapped class. However, this prevents me from initializing the wrapper class. Any elegant way to fix this? class Wrapper: def __init__(self, value): # How to use the default '__setattr__' inside '__init__'? self.value = value def __setattr__(self, name, value): setattr(self.value, name, value) 回答1: You are catching all assignments, which prevents the constructor from assigning