[IronPython] Is there a way to create a new ScriptScope that inherits from global ScriptScope?

Seshadri Pillailokam Vijayaraghavan seshapv at microsoft.com
Sun Aug 10 06:18:29 CEST 2008


Currently there isn't a way to create a new ScriptScope object based on an existing one.

If I understand your query correctly, you can do what you want by iterating over the items of an existing object and copy them over the newer one as soon as your create a new one. Won't this work for you?

      ScriptScope newScope = _pyEng.CreateScope();
      foreach (var item in existingScope.Items) {
            newScope.SetVariable(item.Key, item.Value);
}

Thanks
sesh

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andy.Tao
Sent: Saturday, August 09, 2008 12:08 AM
To: Users
Subject: [IronPython] Is there a way to create a new ScriptScope that inherits from global ScriptScope?

HI guys,

Is there a way to create a new ScriptScope that inherits from global ScriptScope?

 I want to do it like this:
first step: expose some object model to global scope and some global variables;

second step: execute task script in independ scope to avoid modify global objects and variables.

thanks in advanced.
------------------
Andy Tao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080809/474478e9/attachment.html>


More information about the Ironpython-users mailing list