rexec question
Jeremy Hylton
jeremy at cnri.reston.va.us
Thu Aug 5 14:54:52 EDT 1999
There are two completely seperate namespaces that come into play with
rexec. The first is the namespace of the "controlling code," i.e. the
part of your program that created the RExec. The second is the
namespace of the "controlled code," i.e. the code you're running
inside the RExec. Names defined in one namespace do not appear in the
other namespace.
If you want to names 'foo' or 'o' to be visible in the RExec, you need
to define them there. For example:
Python 1.5.2+ (#11, Jun 22 1999, 18:01:08) [C] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
startup
>>> import rexec
>>> code = """class foo:
... def start(self):
... print "foo running"
...
... o = foo()
... o.start()
... """
>>>
>>> filter = rexec.RExec()
>>> filter.r_exec(code)
foo running
>>>
jeremy
More information about the Python-list
mailing list