include in python
Bartek Golenko
bartek at debian.caton.com.pl
Mon May 5 06:31:36 EDT 2003
Bartek Golenko <bartek at debian.caton.com.pl> wrote:
> rewritten anyway, but right now I just want a convinient way to split
> the source code into smaller chunks.
Well, silly to ansver my own question but here is a little workaround I
just found:
fname="primitives.py"; f=open(fname, "r");
c=compile(f.read(), fname, "exec"); eval (c)
fname="xmlhelper.py"; f=open(fname, "r");
c=compile(f.read(), fname, "exec"); eval (c)
It seems to work just fine.
It could possibly be converted into a nice
def include(fname):
...
eval (c, with_sth_wise_here..)
but I have no idea how to reference globals dictionary
--
Bartlomiej Golenko
bartek at zts.ita.pwr.wroc.pl
More information about the Python-list
mailing list