Question about exec()

Erik Max Francis max at alcyone.com
Sun May 30 18:22:05 EDT 2004


Adonis wrote:

> Nevertheless, inside the html document I have
> python enclosed in <? ?> tags, and it executes fine, but if I have a
> few of
> those tags I would like that prior executions stay in memory of the
> same
> document, instead of having to load X module everytime I wish to
> execute the
> code in the same document.

Maintain a separate globals dictionary and give it to exec:

	exec code in myGlobals

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ Life is one long process of getting tired.
    -- Samuel Butler



More information about the Python-list mailing list