Python Object-Oriented Python Advanced Objects Double

Did it just like the video and I am getting it wrong. Any advice?

Can someone help me please.

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

1 Answer

Gabbie Metheny
Gabbie Metheny
33,701 Points

I just rewatched the video, and Kenneth actually doesn't pass self into def __new__: just *args and **kwargs. The self on the next line is just acting as a variable, Kenneth said you actually could name it anything, so it doesn't need to be passed into def __new__. Try removing self on your second line, and it should work!

Gabbie Metheny
Gabbie Metheny
33,701 Points

Oh, just noticed one more thing! You're missing the colon at the end of your def __new__ as well.

Thanks, Gabbie and always your second comment helped me a lot :)