tags:

views:

31

answers:

1

This post in Mike Stall's blog states that

The last expression result is stored as the global variable "_", so you can retrieve it like so:

object o = m_python.GetVariable("_");

But currently in v2 scope has no such variable after executing, e.g.,

scriptEngine.CreateScriptSourceFromString("a=1+2;a+1", SourceCodeKind.Statements);

Is there any way to access result (a+1) without explicitly define variable?

A: 

I suspect with IronPython 2 you need to use SourceCodeKind.Interactive.

I'll try it out later and see if this works.

fuzzyman
With SourceCodeKind.Interactive result is null as well as "_" variable unavailable.
vansickle