On 21/08/2012 22:51, Dan Stromberg wrote:
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!
As there are no other replies, and my apologies if I'm teaching granny
to suck eggs, but there are a load of threads on python-dev discussing
sandboxing. Whether there are any tie ins with importing is for me not
to know and for you to find out :) I'll also wonder out loud if the
reworking of the import mechanism for 3.3 has any impact at all on your
question.
--
Cheers.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list