Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Object-Oriented Python Advanced Objects Double

Remove pass from the body

Remove pass from the body of the Double class. Define the new method. The new method should accept self and one argument. Convert the argument to an int and return it.

doubler.py
class Double(int):
    def __new__(self):
        self = int.__new__(self.)
        self = self[::-1]
        return self

4 Answers

Steven Parker
Steven Parker
229,695 Points

The task 2 instructions say "The new method should accept self and one argument.", but the code here accepts only "self". You need another parameter to accept the argument.

Then, once you have it, the rest of the instructions say "Convert the argument to an int and return it.". You won't need to do anything with "self".

still i didnt get it

Steven Parker
Steven Parker
229,695 Points
    def __new__(self):  # <-- how many arguments besides "self" will this take?

one arguments

Steven Parker
Steven Parker
229,695 Points

If see that function taking an argument other than "self", what's the name of the parameter that will hold the argument?

thank you Steven i got it.

Steven Parker
Steven Parker
229,695 Points

Bashir Orfani — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!