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

What class do all classes extend from, even if you don't explicitly state it?

This is a question in the second part of OOP Python, and the answer is Base.

I don't understand how that is the answer, can someone explain please? Thanks in advance 😁

1 Answer

Josh Keenan
Josh Keenan
20,315 Points

You got me wondering about this and the class is object and can be found in __bases__ . You can do this by opening a python console and simply typing int.__bases__, it contains a tuple of the classes your given class inherits from. You can use any class you can think of.

If this isn't clear enough let me know and I am happy to answer any further questions!

Got it! Thanks Josh!