PageRenderTime 62ms CodeModel.GetById 60ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/python/operator/runme.py

#
Python | 21 lines | 13 code | 6 blank | 2 comment | 0 complexity | 95700950800aae06c8c71662e880ef58 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1# Operator overloading example
 2import example
 3
 4a = example.Complex(2,3)
 5b = example.Complex(-5,10)
 6
 7print "a   =",a
 8print "b   =",b
 9
10c = a + b
11print "c   =",c
12print "a*b =",a*b
13print "a-c =",a-c
14
15e = example.ComplexCopy(a-c)
16print "e   =",e
17
18# Big expression
19f = ((a+b)*(c+b*e)) + (-a)
20print "f   =",f
21