self variable in python ?

Published: 03 September 2024
on channel: Rahul Gaikwad
6
0

"""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


On this page of the site you can watch the video online self variable in python ? with a duration of hours minute second in good quality, which was uploaded by the user Rahul Gaikwad 03 September 2024, share the link with friends and acquaintances, this video has already been watched 6 times on youtube and it was liked by 0 viewers. Enjoy your viewing!