reimport module every n seconds
John Nagle
nagle at animats.com
Mon Mar 21 01:30:53 EDT 2011
On 3/17/2011 3:53 PM, Aahz wrote:
> In article<753e9884-60eb-43cf-a647-12b29ed283a8 at y31g2000prd.googlegroups.com>,
> Santiago Caracol<santiago.caracol at gmail.com> wrote:
>>>> Don't do that. =A0;-) =A0I suggest using exec instead. =A0However, I wo=
>> uld be
>>>> surprised if import worked faster than, say, JSON (more precisely, I
>>>> doubt that it's enough faster to warrnat this kludge).
>>>
>>> I'm with Aahz. =A0Don't do that.
>>
>> I didn't find a good way to calculate and compile the regular
>> expressions once and store them.
Hm. Regular expression compilation in CPython happens when
you call "re.compile", not when .pyc files are generated.
You can call "re.compile" on strings read from an external
source without loading a new module.
John Nagle
More information about the Python-list
mailing list