G <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> --=_Part_187401_13883248.1185238999144
> 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:
>
Thanks a lot Matt and Steve. I replaced __int__ with __new__ and it worked
On 7/23/07, Matt McCredie <[EMAIL PROTECTED]> wrote:
Do you guys know why the if statement is not evaluated?
For immutable types __new__ is called before __init__. There are some
details here: http://docs.python.org/r
G wrote:
> 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