Douglas Palma3,471 Points
Not passing task2
watched the video a few times but still not passing. im giving my brain a little break can anyone see what im doing wrong?
class Double(int): def __new__(*args, **kwargs): return int(*args, **kwargs).__init__()
nicole lumpkinCourses Plus Student 5,328 Points
Honestly, I remember going through this unit and my brain was just fried :) So first off new is a magic method used with immutable types such as int. So it doesn't make sense to bring init into the mix, since that's used for mutable types. Your first two lines of code are perfect, now on to the weird part(at least it is for me). Because new has a return value we need to create an instance(in this case, a new integer instance) to return. I believe it is conventional to assign said instance to a variable named self, then return it.
class Double(int) def __new__(*args, **kwargs): self = int.__new__(*args, **kwargs) return self
Hope this helps :)