There is a questions asking how to simulate static variables in python.
Also, on the web one can find many different solutions to create static variables. (Though I
One alternative to a class is a function attribute:
def foo(arg): if not hasattr(foo, 'cache'): foo.cache = get_data_dict() return foo.cache[arg]
While a class is probably cleaner, this technique can be useful and is nicer, in my opinion, then a global.