PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/python/functor/runme.py

#
Python | 17 lines | 9 code | 5 blank | 3 comment | 2 complexity | 56516f7b04da29b324a29a070fb302de MD5 | raw file
 1# Operator overloading example
 2import example
 3import math
 4
 5a = example.intSum(0)
 6b = example.doubleSum(100.0)
 7
 8# Use the objects.  They should be callable just like a normal
 9# python function.
10
11for i in range(0,100):
12    a(i)                # Note: function call
13    b(math.sqrt(i))     # Note: function call
14
15print a.result()
16print b.result()
17