Reimporting modules, and sandboxing?

Dan Stromberg drsalists at gmail.com
Tue Aug 21 17:51:40 EDT 2012


I know I've seen this discussed before, and I came away from observing the
discussion thinking "Python doesn't do that very well...", but we have some
people here who really would like to do this, and I need to better
understand the pros and cons now.

Is there a good way of reimporting an _independent_ set of CPython modules?

I'm aware of these issues:
http://stackoverflow.com/questions/1254370/reimport-a-module-in-python-while-interactive
http://docs.python.org/library/functions.html#reload

Are there more?<http://stackoverflow.com/questions/1254370/reimport-a-module-in-python-while-interactive>

Does sandboxing Python code help in some way?  If yes, then what kind of
sandbox?  Note that this isn't sandboxing to prevent execution of malicious
code, it's sandboxing to preserve reimportability, which may be an easier
constraint to satisfy.  The modules are friendly to each other, they aren't
trying to break into each other, we just have to be careful that they don't
step on each other's ability to reimport accidentally.

Although I love Pypy, I don't think we'll be able to use Pypy sandboxes
this time around.

Also, if we need to reload 3 modules at once, can reload() reimport them
atomically, as a set?  Or would it need to do them one at a time?

In short, we're talking about having some code that allows automatically
re-importing changed modules.  These modules will be pretty independent of
each other in the Python world, but might interact with each other in the
REST world even though they're written in CPython.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120821/cbf26421/attachment.html>


More information about the Python-list mailing list