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


Nicholas Gaerlan
Nicholas Gaerlan
9,501 Points

Why do you need to explicitly provide an argument when **kwargs takes any key, value pair?

In the example for the video, why can't you still create a "Thief" with the same arguments

person = Thief("Bob", sneaky=False, hair_style = "sad mullet")

without overriding the parent class __init__ method? As long as a string for a name variable is declared first, then as long as every following element is a "key, value" pair or "var = [data-type]", wouldn't your Thief end up inheriting that attribute?

So if in this case, without overriding the parent method with the "super()" call, if I just initialized a Theif with the arguments ("Bob", sneaky = False) then I understand this to happen:

  1. A Theif is created inheriting all the Parent methods and attributes
  2. Since the parent accepts all key, value pairs and creates attributes from them, then the Thief should have a sneaky = False attribute because I used that argument.

I see a potential conflict in that the sub-class of Thief sets it's attribute to "True" by default, so is that it? I guess I'd like to know the order or sequence of events so that I understand exactly when things are created and overridden.