"""self Variable:"""
self is a reference variable that points to the
current object
it is used to refer instance
variables and methods.
"""
self should be first parameter inside constructor
and inside instance methods
"""
class Example:
def __init__(self):
pass
def instance_method_name(self):
pass
obj1 = Example()
obj1.instance_method_name()
When we create an object of a class, the
object name contains the memory location
of the object.
This memory location is internally passed to self, as
self knows the memory address of the object
so we can access variables and methods of the object.
#python #pythonprogramming
#coding #programming
#coder #oop #python3
#software
#pythonforbeginners
#pythonfordataanalysis
#developer
#development
En esta página del sitio puede ver el video en línea self variable in python ? de Duración hora minuto segunda en buena calidad , que subió el usuario Rahul Gaikwad 03 septiembre 2024, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 6 veces y le gustó 0 a los espectadores. Disfruta viendo!