I am learning OOP with Python and I consider that I have already understood the basics to understand how to create and instantiate a class but I have a question of syntax. Reviewing different examples to practice I have been able to see that a class can be created with slight differences but that I instantiate them in the same way (without problems).
# Form 1
class Dog:
def __init__(self, name):
self.name = name
def ladrar(self):
print("grrr", self.name, " - esta ladrando...")
# Form 2
class Cat():
def __init__(self, name):
self.name = name
def mauyar(self):
print("miau miau", self.name, " - esta mauyando...")
# Form 3
class Rat(object):
def __init__(self, name):
self.name = name
def molestar(self):
print("ggg ggg", self.name, " - esta molestando...")
# Creating objets
primerPerro = Dog("rufo")
primerPerro.ladrar()
primerGato = Cat("gaturra")
primerGato.mauyar()
primerraton = Rat("micky")
primerraton.molestar()
Check this documentation about classes in the Python files (LINK) and I can see that they use the first way to define the classes but I couldn't find reference to the second and third way.
In which cases would the second and third form be used (they are correct forms)