aboutsummaryrefslogtreecommitdiff
path: root/Examples/python/functor/runme.py
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/python/functor/runme.py')
-rw-r--r--Examples/python/functor/runme.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Examples/python/functor/runme.py b/Examples/python/functor/runme.py
new file mode 100644
index 000000000..8fc0f2ff2
--- /dev/null
+++ b/Examples/python/functor/runme.py
@@ -0,0 +1,17 @@
+# Operator overloading example
+import example
+import math
+
+a = example.intSum(0)
+b = example.doubleSum(100.0)
+
+# Use the objects. They should be callable just like a normal
+# python function.
+
+for i in range(0,100):
+ a(i) # Note: function call
+ b(math.sqrt(i)) # Note: function call
+
+print a.result()
+print b.result()
+