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

Rainer Worbis r.worbis at cubido.at
Sun Aug 10 17:21:37 CEST 2008


Hi,

 

i had the same problem (hierarchical script scopes) and solved it by
implementing my own SymbolDictionary (exactly BaseSymbolDictionary)

So I can use the vars defined along the hierarchy like in scopes in c#. 

 

Rainer

 

Von: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] Im Auftrag von Seshadri
Pillailokam Vijayaraghavan
Gesendet: Sonntag, 10. August 2008 06:18
An: Discussion of IronPython
Betreff: Re: [IronPython] Is there a way to create a new ScriptScopethat
inherits from global ScriptScope?

 

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/20080810/7d020391/attachment.html>


More information about the Ironpython-users mailing list