In Python 2.7, I am trying to set a class variable based on static methods.
class Params(object):
DEFAULT_PATH = Params._set_default_path()
@staticmethod
def _set_default_path():
return os.path.expanduser(
"~/prod") if Params._is_host_in_prod() else os.path.expanduser(
"~/qa")
@staticmethod
def _is_host_in_prod():
return True # always prod, example code
when I execute the code, I get NameError: name 'Params' is not defined, what's the Pythonic way to do it?