Hacker News new | ask | show | jobs
by hythloday 5258 days ago
Hey, thanks for the reply, I do see your point now--I thought you were referring to the usual case of importing modules. It's true that Python modules aren't implemented in terms of dicts or lists and that Python is a larger language than Lua, so I think I completely agree with the point you were making. :)

For future reference, I'd implement your dynamic module importer like this:

  def dynamic_import(name):
       import imp
       return imp.load_module(name, *import.find_module(name))

  os = dynamic_import("os")
1 comments

Thanks for the pointer! I'll have to keep that in mind.