I have this code:
class GameChar:
def __init__(self, name, health, level):
self.name = name
self.health = health
self.level = level
def speak(self):
print('Him ,my name is: '+self.name)
class Villain(GameChar):
def kill(self, person):
print("I will kill "+person.name)
person.health = 0
print("You are dead")
Mathew = GameChar("Mathew", 300, 25)
Hell = Villain("Hell", 1000, 100)
Hell.kill(Mathew)
print (Mathew.health)
I get why we need self in the constructor or in methods that are somehow using class element's data, but why do i need self if I'm only performing operation on element of another class. Why do I need a link on myself in this instance?
Is there any point of using bytecode to understand this?