summaryrefslogtreecommitdiff
path: root/trunk/Examples/python/operator/runme.py
blob: 3687a38de6c535ac1c3b10097ed806deea13a550 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Operator overloading example
import example

a = example.Complex(2,3)
b = example.Complex(-5,10)

print "a   =",a
print "b   =",b

c = a + b
print "c   =",c
print "a*b =",a*b
print "a-c =",a-c

e = example.ComplexCopy(a-c)
print "e   =",e

# Big expression
f = ((a+b)*(c+b*e)) + (-a)
print "f   =",f