/trunk/Examples/python/functor/runme.py
Python | 17 lines | 9 code | 5 blank | 3 comment | 1 complexity | 56516f7b04da29b324a29a070fb302de MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- # 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()