I am trying to make a class called DevOpt
, that is used as a "static class" (not instantiated), and any static attribute look up on it returns False
, however the __getattribute__
is not working (from my research it should override instance and class attribute look ups):
# Python 3.8
class DevOpt:
def __getattribute__(obj, _):
return False
# Want DevOpt.anything to return False:
>>> DevOpt.foo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'DevOpt' has no attribute 'foo'
>>> DevOpt.__getattribute__(DevOpt, 'foo')
False