Python Object-Oriented Python Inheritance Super-Duper!

Jacob Rummel
Jacob Rummel
3,103 Points

Getting TypeError when trying to follow along with Kenneth here [Solved]

Here's my code that I thought looks the same as Kenneth's:

class Character:  
    def __init__(self, name, **kwargs): = name 

        for key, value in kwargs.items(): 
            setattr(self, key, value) 

class Thief(Character): 
    sneaky = True 

    def __init__(self, name, sneaky=True, **kwargs):
        super().__init__(self, name, **kwargs)
        self.sneaky = sneaky

But I'm getting this traceback:

TypeError: init() takes 2 positional arguments but 3 were given.

Getting that error regardless of how many arguments I actually use in initialization.

[MOD: marked title as "Solved" -cf]

Jacob Rummel
Jacob Rummel
3,103 Points

Figured out my mistake!

I had the super()__init__call taking self as a parameter and that was screwing things up. I had gotten into the habit of putting self into everything when working with classes!