How can I refer to class variable in a function without referring to its class in Python?
- by Alex B
I have a following class:
class Foo:
CONSTANT = 1
def some_fn(self):
a = Foo.CONSTANT
# do something
How can I refer to Foo.CONSTANT without referring to Foo, or refer to Foo in a generic way? (I don't want to change all references to it when renaming a class)