Zen of python says "Namespaces are one honking great idea -- let's do more of those!".
Implies the following is pythonic.
do_thing(vars.important_value)
When we include the import of vars as a module in our example; did the pythonic nature change? Isis this still pythonic? (I would say it is)
import vars
do_thing(vars.important_value)
How about if we change how it's imported? Isimported; is it still pythonic? (again, I'd say yes)
from some_module import vars
do_thing(vars.important_value)
How about when we use an instance of a class?
class Vars:
def __init__(iv):
self.important_value = iv
vars = Vars(1234)
do_thing(vars.important_value)
That last bit is what got me. If instantiating a class is the key to creating a namespace outside of a module in order be pythonic, that would seem to contradict "simple is better"
It's for this reason I say using aan uninstantiated class in this manneras a namespace is indeed pythonic, even if not often used.