Python Object-Oriented Python Advanced Objects Double

Brad Givens
Brad Givens
6,621 Points

Overriding __new__

Code isn't passing and I'm not sure why. Is it something to do with returning the instance?

doubler.py
class Double(int):
    def __new__(*args, **kwargs):
        return (int)

1 Answer

K.D. Harris
K.D. Harris
10,828 Points

in the final line, you have to call the method on your int instance like so:

          return int.__new__(*args, **kwargs)