good_getattr.py 198 B

1234567891011
  1. x = 1
  2. def __dir__():
  3. return ['a', 'b', 'c']
  4. def __getattr__(name):
  5. if name == "yolo":
  6. raise AttributeError("Deprecated, use whatever instead")
  7. return f"There is {name}"
  8. y = 2