IronPython: Changing behaviour of SourceCodeKind.InteractiveCode
问题 I can execute IronPython in C# with: ScriptSource Source = PyEngine.CreateScriptSourceFromString(Code, SourceCodeKind.InteractiveCode); CompiledCode Compiled = Source.Compile(); Compiled.Execute(PyScope); This means that I can execute A=1 and then A . This will then output 1 . Is there a way I can override this behaviour so A will be redirected to a C# function, say CustomPrinter before printing? I know I can 'overload' the print function as described by https://stackoverflow.com/a/13871861