"""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
Auf dieser Seite können Sie das Online-Video self variable in python ? mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Rahul Gaikwad 03 September 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 6 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!