Why self is used in Python classes?

Опубликовано: 11 Сентябрь 2024
на канале: 2MinutesPy
11,987
630

Why self is used in Python classes? Wait! First, what does self mean in Python and what is its role in object-oriented programming?

Have you ever wondered, why we pass self in the constructor or any method inside a Python class? Or do you use it because everyone does the same? In this video, you'll understand why self is used in Python, what it means, and the importance of self in object-oriented programming.

Chapters:
⏩ 0:00 Self in Python
⏩ 1:01 Why self is used?
⏩ 1:28 Code
⏩ 2:17 Outro

✨More on 2MinutesPy👇👇

▶️How to Create a Class in Python?    • How to Create a Class in Python? 2MinutesPy  

▶️ Python's _init_ Method:    • Python's __init__ Method | 2MinutesPy  

▶️ Python's ABC (Abstract Base Class):    • Python's ABC (Abstract Base Class) in 2 Mi...  

▶️ The "Diamond Problem" in Class Inheritance:    • The "Diamond Problem" in Class Inheritance  

▶️ What should you write into the __init__.py file?    • What should you write into the __init__.py...  

Subscribe to    / @2minutespy   for more such videos.

@2MinutesPy

#self #class #oop #objectorientedprogramming #init #python #pythonprogramming #coding #2minutespy


На этой странице сайта вы можете посмотреть видео онлайн Why self is used in Python classes? длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь 2MinutesPy 11 Сентябрь 2024, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 11,987 раз и оно понравилось 630 зрителям. Приятного просмотра!