I currently have code like this:
cache = 1 def foo(): global cache # many # lines # of code cache = 2
However, this may
class Cache: myvar = 1 def foo(): Cache.myvar = 2
This way, Cache.myvar is practically a "global". It's possible to read/write to it from anywhere.
Cache.myvar
I prefer this over the dictionary alternative, because it allows for auto-complete of the variable names.