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

OOP - Subclassing Built-Ins (Use of self with __new__)?

I understood from the video that a self argument is not required when using new with classes (as the method acts on the class and not on the instance). However, the corresponding code challenge requests, "Define the new method. The new method should accept self and one argument." , which appears to be a contradiction. What am I missing or not understanding? Many thanks in advance for your help, all.

1 Answer

Josh Keenan
Josh Keenan
20,315 Points

Can you link to the challenge, it is wrong and should be cls instead of self as far as I am aware.