Operator overloading

MartinRinehart at gmail.com MartinRinehart at gmail.com
Fri Jan 25 15:26:42 EST 2008



Hexamorph wrote:
> You mean you want the ability to change for example the + operator
> for ints to something like calculating the cosine instead of doing
> addition?

Sure. Cosines are a monadic operation and the monadic '+' is a NOP, so
why shouldn't I define +45 to return cosine of 45, (presuming I needed
lots of cosines). I'd even let you define your own operators. Lots of
programmers really liked '++' and '--', for examples.




More information about the Python-list mailing list