I have found myself in the habit of using code like this.
class glb:
"just for holding globals"
args = None # from argparse
conf = None # from configparser
def main():
...
glb.args = parser.parse_args()
glb.conf = loadconf(fn)
Assuming there is a case for using globals, I feel that this is a nice and clean way of doing it. It's a kind of a singleton pattern.
It’s simpler to spot thee glb.
prefix than standard globals. However, I don't write that much object-oriented Python or larger projects, so I'm uncertain if there could be side effects or other gotchas that I'm not aware of.
So in short: Are there any downsides to doing it like this? Does it smell? Is there a better more pythonic way?