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 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
229,644 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 .