the difference of "exec" and "import" in python

tom z maillist.tom at gmail.com
Tue May 3 08:16:37 UTC 2011


Hi~ all guys,
I have a strange question, what's the difference of "exec" and "import"?
IMO, when we use "import", the script is also be executed, (maybe its
namespace is owned by itself), and "exec" does something like this, it
executes some script. So i think its difference is its namespace.
I want to get your hint~

thanks a lot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/python-devel/attachments/20110503/fdf529c5/attachment.html 


More information about the python-devel mailing list