reimport module every n seconds
Aahz
aahz at pythoncraft.com
Thu Feb 17 13:05:13 EST 2011
In article <6cde71c6-5c56-40ea-9849-50fc44e5decc at o14g2000prb.googlegroups.com>,
Santiago Caracol <santiago.caracol at gmail.com> wrote:
>
>a server program of mine uses data which are compiled to a Python
>module for efficiency reasons. In some module of the server program I
>import the data:
>
>from data import data
>
>As the data often changes, I would like to reimport it every n (e.g.
>10) seconds.
Don't do that. ;-) I suggest using exec instead. However, I would be
surprised if import worked faster than, say, JSON (more precisely, I
doubt that it's enough faster to warrnat this kludge).
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"Programming language design is not a rational science. Most reasoning
about it is at best rationalization of gut feelings, and at worst plain
wrong." --GvR, python-ideas, 2009-03-01
More information about the Python-list
mailing list