Python Module identifies as dict
Question: Lets say I have a lot of key-pair data. I would like to have this data in a
package so that it can be imported. Is there a way to make modules work like
dicts, for performance and extendibility reasons?

Example:

    
    
    common/pairs/
     ├── BUILDINGS.py
     └── __init__.py
    
    import BUILDINGS
    
    BUILDINGS["foo"] == "bar"
    

Note: The desired result can be archived by putting declaring `BUILDINGS` in
`__init__.py` but they will all be compiled every time, its not drag and
undroppable, and it seems ugly.

Is there a way to achieve this well? Is there a way to achieve it at all?


Answer: Not that I recommend it, but you can assign the `dict` into `sys.modules`.
Python doesn't care that what's there is actually a module object.

    
    
    # BUILDINGS.py
    from sys import modules
    if __name__ != "__main__":
        modules[__name__] = {'a': 1, 'b': 2, ...}
    

