As an example of what I am looking to achieve, I have created a Person class that inherits from Speech:
class Habla:
def expresion(frase, grita):
if grita:
return frase.upper()
else:
return frase
class Persona(Habla):
def __init__(self, frase, grita):
self.grita = grita
self.frase = super().expresion(frase, grita)
persona = Persona(frase="Aghh!", grita=True)
The problem I have is that I get an error when executing the method expresion
of the class Speak.
I get the error:TypeError: expresion() takes 2 positional arguments but 3 were given
I suspect that the parameter self
is involved in the matter, but I don't know the cause.
I tried with the debug but I couldn't find when 3 parameters are passed to the method expresion
.
Thanks in advance for any explanation you can give me. I emphasize that my goal is to be able to execute an inherited method inside a class and that I would like to know why I receive this error.
All the best.