python – 参数如何通过__getattr__传递给一个函数

python – 参数如何通过__getattr__传递给一个函数

考虑下面的代码示例( python 2.7): class Parent: def __init__(self, child): self.child = child def __getattr__(self, attr): print(Calling __getattr__: +attr) if hasattr(self.ch