PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1.3.35/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
  2. import example
  3. a = example.Complex(2,3)
  4. b = example.Complex(-5,10)
  5. print "a =",a
  6. print "b =",b
  7. c = a + b
  8. print "c =",c
  9. print "a*b =",a*b
  10. print "a-c =",a-c
  11. e = example.ComplexCopy(a-c)
  12. print "e =",e
  13. # Big expression
  14. f = ((a+b)*(c+b*e)) + (-a)
  15. print "f =",f