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