This discussion makes me wonder if my use module as globals namespace idea still has merit. The basic idea is that LOAD_GLOBAL does getattr()
on the module object, rather than __getitem__
on the module dict object. That gives you a place to put this lazy loading hook. I originally started down that path when I was trying to implement lazy module loading.
1 Like