Python operators returning ints

Posted by None on Stack Overflow See other posts from Stack Overflow or by None
Published on 2010-05-05T23:05:01Z Indexed on 2010/05/05 23:08 UTC
Read the original article Hit count: 108

Filed under:

Is there any way to have Python operators line "==" and ">" return ints instead of bools. I know that I could use the int function (int(1 == 1)) or add 0 ((1 == 1) + 0) but I was wondering if there was an easy way to do it. Like when you want division to return floats you could type from __future__ import division. Is there any way to do this with operators returning ints? Or could I make a class extending __future__._Feature that would do what I want?

© Stack Overflow or respective owner

Related posts about python

Related posts about bool