Defining __init__

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

You seem to have a lot of confessions to make

Rick-urej
Автор

FYI: self is not actually a keyword in Python, but rather, a convention. Subtle but important difference.

matthewmercury
Автор

Excellent discussion on "__init__" and "self" - very well done video.

NOPerative
Автор

2:23
absolutely brilliant. __init__ clearly explained

fet
Автор

Awesome job, man! Thank you very much for sharing your knowledge in such a clean and understandable way.

iapujol
Автор

The only __init__ explanation I could understand. Thank you.

fabiorodrigo
Автор

This might be more helpful. Add print(id(toy_story)) under toy_story = media.Movie(). And add print(id(self)) inside your function. You will see that both are the same.

Almost every variable you create gets it's own id in Python. And because you can create multiple objects with the same class in Python. By typing self you're telling that function within your class that you want that function to be executed for that specific id.

You can think of it like this. Your class is a blueprint for a house. But not all houses are going to look the same. So, to make it clear to your program which address I'm dealing with, I'm adding self. That's why toy_story and self will have the same id.

So, if you would create a different variable (a different "house") like toy_story2, it will have a different id. And the self will also be different.

I hope that I haven't overcomplicated it.

onee
Автор

Self is the object being created... meditators are just now discovering ancient wisdom that programmers have known for centuries

ltsamsonite
Автор

Excellent tutorial! You rock, bro! Many thanks! Have a chai!

klauschia
Автор

THANK YOU FOR MAKING THIS SO EASY TO UNDERSTAND!

mikelego
Автор

Lovely class, thank you for your kindness!

aykikard
Автор

this was very concise and comprehensible! thanks!

DaveO
Автор

Saved my day. Thank you very much my good sir!

brenomarcolino
Автор

Wow I enjoy how you explained it to us

Ali-zdsz
Автор

Excellent.
So "title" is a variable taking the input from "movie_title" var. arg. in the init funct(), right?

AmitKumarSahoo
Автор

Thank you for that video it helped me very much

dagreatesthumanever
Автор

How can I apply this knowledge in a Django framework 🙏

rhemamusic
Автор

Thank you for the video! It was very clear.

tymothylim
Автор

I have a confedion to make:this video is good

teamproxy
Автор

Awesome! but where's the next video

ankathilokesh