[IronPython] OnVarChanged() - Repost

John Mancine john at emergentlifetech.com
Wed Jun 21 22:43:03 CEST 2006

-- I'm reposting this because I saw that it didn't show up on my list. I
apologize if this turns into a dupe. -- 


Thanks for the advice, but I actually noticed that when I do...

pyEngine.Execute("a=1"), I do not in fact hit ModuleScope.SetGlobal(), but I
do however hit ModuleScope.SetLocal(). I took your advice though and I
extended ModuleScope, but I found I had to override both SetGlobal and
SetLocal to catch all cases which works fine, but I feel like I'm shooting
in the dark a bit since I don't have a clear understanding as to what the
two versions are really for.

Care to shed some light on this? I am a bit lost as to what IronPython means
by 'local' and 'global' as it seems like they are very close to the same
thing in the sense that I can do engine.SetGlobal("a", 1) or
engine.Execute("a=1") and basically do the same thing but one goes through
SetGlobal() and one goes through SetLocal().

Take care,

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users- 
> bounces at lists.ironpython.com] On Behalf Of Shri Borde
> Sent: Wednesday, June 21, 2006 2:00 PM
> To: Discussion of IronPython
> Subject: Re: [IronPython] OnVarChanged
> You should be able to declare a type that inherits from ModuleScope, 
> and override ModuleScope.Get/SetGlobal. That should be the hook you 
> need. Then you can use engine.Execute("a=1", myCustomModuleScope).

More information about the Ironpython-users mailing list