I would do something along the lines of the following, although it only tests for integers and not floats, so would return 'None' for a float.
class Nint(int):
def __add__(self, x, y):
if isinstance(x, int) and isinstance(y, int):
return x+y
return None
if __name__=='__main__':
N=Nint()
print N.__add__( 1, 2 )
print N.__add__( 1, None )
--
http://mail.python.org/mailman/listinfo/python-list
