4 > executePythonStatement "foo = 'bar'\nd = dir()"
\r
5 > getPythonStringArrayVariable "d"
\r
6 vector ["__builtins__", "__doc__", "__loader__", "__name__", "__package__", "__spec__", "foo"]
\r
8 > getPythonStringVariable "__name__"
\r
11 > setPythonDoubleVariable "foo" 1
\r
12 > executePythonStatement "foo = foo + 1"
\r
13 > getPythonDoubleVariable "foo"
\r
16 > setPythonDoubleArrayVariable "foo" (vector [1.0, 2.0, 3.0])
\r
17 > executePythonStatement "foo = foo + [4.0]"
\r
18 > getPythonDoubleArrayVariable "foo"
\r
19 vector [1.0, 2.0, 3.0, 4.0]
\r
21 > setPythonIntegerVariable "foo" 5
\r
22 > executePythonStatement "import math"
\r
23 > executePythonStatement "bar = math.factorial(foo)"
\r
24 > getPythonIntegerVariable "bar"
\r
27 > setPythonIntegerArrayVariable "foo" (vector [1, 2, 3, 4])
\r
28 > executePythonStatement "foo.append(sum(foo))"
\r
29 > getPythonIntegerArrayVariable "foo"
\r
30 vector [1, 2, 3, 4, 10]
\r
32 > setPythonBooleanVariable "foo" False
\r
33 > executePythonStatement "foo = not(foo)"
\r
34 > getPythonBooleanVariable "foo"
\r
37 > setPythonVariable "foo" ([1.0, 2.0, 3.0, 4.0] :: [Double])
\r
38 > executePythonStatement "foo.append(sum(foo))"
\r
39 > getPythonVariable "foo" :: [Double]
\r
40 [1.0, 2.0, 3.0, 4.0, 10.0]
\r
41 > py = openPythonContext
\r
42 > runWithPythonContext py $ setPythonIntegerVariable "foo" 4
\r
43 > runWithPythonContext py $ setPythonDoubleArrayVariable "bar" (vector [1.0, 2.0, 3.0])
\r
44 > runWithPythonContext py $ executePythonStatement "bar.append(float(foo))"
\r
45 > bar = runWithPythonContext py $ getPythonDoubleArrayVariable "bar"
\r
46 > closePythonContext py
\r
48 vector [1.0, 2.0, 3.0, 4.0]
\r