What is self in Python?

preview_player
Показать описание
Python's "self" is really just a variable that points to the current instance of our class. Every method you define must accept "self" as its first argument.

00:00 A Python class with self in each method
00:28 Do we need that self argument?
01:22 What is self?
02:26 But what does self mean? Could we rename it?
03:10 Recap: self is the first method of every Python class

#python #oop
Рекомендации по теме
Комментарии
Автор

Add "Python ASMR" to the video title

saluberis
Автор

People here complaining about you being too silent, bug frankly it like it, its nice and soothing ✌🏻

thoughtdeeper
Автор

Very interesting and helpful explanation. You are an excellent teacher. Good work !

SoniaChavez-jehq
Автор

I like the short content. I also like “this” better because I am already used to that from C++ 😂

hudatolah
Автор

one thing i still cant understand about like self is why do we use a getitem magic method and return self[index] instead of self.array[index] still figuring this out lol

Anonymous-rimk
Автор

This is why I prefer ruby. Self is the instance, no need to pass it around.

chrishabgood
Автор

cool stuff, but why are u whispering ?

itsomarka
Автор

Yet another Python quirk that becomes IMMEDIATELY simpler when you write a bit of C.

There is no such thing as a function that can magically access some local variable. For the function to have access to the data of the object, the object must be passed into the function. That is self.

yoavmor
Автор

Can you lower the audio? Its very loud.

techrazor
Автор

Self refers to the objects that are created within the class. Self==class object.

AlexandreFerreira-jbjl
Автор

awesome explanation man... really great..

so can we have different words for each instance? like can we have self in one this in other method... or xyz in another can we have different ones in each?

i am not asking about best coding pracitces.. i am asking CAN we do it? can it be done?

akashbharadwaj
Автор

too silent, you can make the video a bit louder

vorfreu
Автор

thanks for the guide but bro are you good? You look like you haven't slept in days

hw_was_taken
Автор

"pyladies", "django girls"

shanmugaraj
Автор

Still, it makes the syntax look self everwyere as a hidden 1st variable to function...

KW-jjuy
Автор

kindly use good mic, your voice is too low

AkshaySharma-vmsp
welcome to shbcf.ru