self keyword in Python
What happens if I don't use self keyword in methods? I have found this doubt while doing an Inheritance example. Thanks in advance. Two code snippets for reference: With self keyword class Animal: def __init__(self, name, color): self.name = name self.color = color class Cat(Animal): def purr(self): print("Purr...") class Dog(Animal): def bark(self): print("Woof!") fido = Dog("Fido", "brown") print(fido.color) fido.bark() Without self keyword: class Person: def __init__(self, name, age): self.name = name self.age = age class Manager(Person): def role(): print("Manager is a person") class Employee(Person): def role(): print("Employee is a person") def address(): print("India") kishan = Manager("Kishan", 32) print(kishan.name)