> import "Python" > > runPython do > executePythonStatement "foo = 'bar'\nd = dir()" > getPythonStringArrayVariable "d" vector ["__builtins__", "__doc__", "__loader__", "__name__", "__package__", "__spec__", "foo"] > runPython do > getPythonStringVariable "__name__" "SCL_2" > runPython do > setPythonDoubleVariable "foo" 1 > executePythonStatement "foo = foo + 1" > getPythonDoubleVariable "foo" 2.0 > runPython do > setPythonDoubleArrayVariable "foo" (vector [1.0, 2.0, 3.0]) > executePythonStatement "foo = foo + [4.0]" > getPythonDoubleArrayVariable "foo" vector [1.0, 2.0, 3.0, 4.0] > runPython do > setPythonIntegerVariable "foo" 5 > executePythonStatement "import math" > executePythonStatement "bar = math.factorial(foo)" > getPythonIntegerVariable "bar" 120 > runPython do > setPythonIntegerArrayVariable "foo" (vector [1, 2, 3, 4]) > executePythonStatement "foo.append(sum(foo))" > getPythonIntegerArrayVariable "foo" vector [1, 2, 3, 4, 10] > runPython do > setPythonBooleanVariable "foo" False > executePythonStatement "foo = not(foo)" > getPythonBooleanVariable "foo" True > runPython do > setPythonVariable "foo" ([1.0, 2.0, 3.0, 4.0] :: [Double]) > executePythonStatement "foo.append(sum(foo))" > getPythonVariable "foo" :: [Double] [1.0, 2.0, 3.0, 4.0, 10.0] > py = openPythonContext > runWithPythonContext py $ setPythonIntegerVariable "foo" 4 > runWithPythonContext py $ setPythonDoubleArrayVariable "bar" (vector [1.0, 2.0, 3.0]) > runWithPythonContext py $ executePythonStatement "bar.append(float(foo))" > bar = runWithPythonContext py $ getPythonDoubleArrayVariable "bar" > closePythonContext py > bar vector [1.0, 2.0, 3.0, 4.0]