"""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
Sur cette page du site, vous pouvez voir la vidéo en ligne self variable in python ? durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Rahul Gaikwad 03 septembre 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 6 fois et il a aimé 0 téléspectateurs. Bon visionnage!