Re: [Ironpython-users] Simulating Python's scoping at the DLR level

2011-12-20 Thread Curt Hagenlocher
I don't think you can replicate Python's semantics exactly, because Python compiles an entire block at once but your scope would only see reads and writes sequentially as they happen. For instance, in Python, the following code will generate an error: a = 1 def test(): print(a) a = 2 That

[Ironpython-users] Simulating Python's scoping at the DLR level

2011-12-20 Thread Doug Blank
What would be a good way to simulate Python's scoping rules at the DLR level? For example, if I were running two DLR-based scripts, I can just use the same ScriptScope for both to have shared globals. But how would you replicate Python's exact idea of a local environment in each, while falling ba