I'm learning Python and stumbled upon the OOP part. At the time I did my first steps with the PHP OOP but the same thing happens to me, I don't understand how to use the self value inside a method.
I've been reading around the internet and it talks about self-referencing the class and so on, but honestly, I don't understand that concept.
For example:
class Persona:
def inicializar(self,nom):
self.nombre=nom
def imprimir(self):
print("Nombre",self.nombre)
persona1=Persona()
persona1.inicializar("Pedro")
persona1.imprimir()
persona2=Persona()
persona2.inicializar("Carla")
persona2.imprimir()
Would someone be so kind as to explain to me what this is for self
?