good_getattr.py 198 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
x = 1

def __dir__():
    return ['a', 'b', 'c']

def __getattr__(name):
    if name == "yolo":
        raise AttributeError("Deprecated, use whatever instead")
    return f"There is {name}"

y = 2