python - why would load_module be called if the module is already in sys.modules? -
pep302 says load_module
must return entry in sys.modules
if 1 exists. seems unnecessary burden, because caller (i.e. python's import system) could in sys.modules
before calling load_module, , notice load_module
has no real work (but not reason?).
if idea notify loader import being attempted, seems calling my_loader.already_loaded(module)
(or similar interface) better, because then, load_module
can focus on it's "real" job, , not have worry whether module in sys.modules
.
Comments
Post a Comment