Hi, I am trying to subclass int to allow a constructor to accept None. I am trying the following
class INT(int):
def __init__(self, x):
if x is None:
return None
else:
int.__init__(x)
b = INT(x=None)
When i run the previous code i get the following error:
b = INT(x=None)
TypeError: int() argument must be a string or a number, not 'NoneType'.
Do you guys know why the if statement is not evaluated?
Thanks for your help
-- http://mail.python.org/mailman/listinfo/python-list
