Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Object-Oriented Python Inheritance Super-Duper!

remove sneaky = True from Thief class?

I notice that Kenneth leaves sneaky = True in the Thief class above the init method. As the init method now contains that variable, would it be best practice to now remove that from being a class variable (may be using some incorrect terminology here...)? Or does it serve some purpose that I don't understand?

2 Answers

Steven Parker
Steven Parker
210,423 Points

It's possible for a class to have a class attribute and an instance attribute with the same name, and it's not clear if the class attribute might have some use later on.

But you're right, if you don't intend to use the class attribute for something else, it would be a good idea to remove it when you replace it with an instance attribute.

I can't fully respond to your question from the video, but I can say that we have created a new class it should have some of its own initial attributes and methods or else whey even inherit the class or create a new one, but honestly I don't feel that problem or situation the teacher introduced is very convincing that's why I see many people confused. because I have tried to call thief class and use and set the sneaky attribute to False and it worked without me using super if I didn't set it to false it would still be there and be True .