Using fractions instead of floats

Terry Reedy tjreedy at
Tue Oct 2 05:33:45 CEST 2007

"andresj" < at> wrote in message 
news:1191283765.496514.94080 at
|| I know from __future__ import division changes the behaivour to return
| floats instead of ints, but what I meant is to be able to implement a
| function (or class/method) which would return what _I_ want/decide.

When you define your own class, you can make any operator (on instances of 
that class) mean anything you want.  But to use such methonds, once 
defined, you first have to make instances of that class using 
classname(init data) or whatever.

There is no way to hijack int op int though.


More information about the Python-list mailing list