Claudio Grondi wrote:
STeVe,

may I ask you for more details on this?
Any disadvantages while using exec()
in this context?

I try to avoid using any of the
__xxxx__() functions if possible
(considering this a good
programming style).

Avoiding exec (which is a statement, not a function) is much more important. Since it executes arbitrary code, you can get unpredictable results from it.

>>> z = "sys; print 'w00t'"
>>> exec "import " + z
w00t

Consider the case where z = "shutil; shutil.rmtree('/')"
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to