Python Tutorial 13 - Classes and Scope

preview_player
Показать описание

📣 Other Social:
Рекомендации по теме
Комментарии
Автор

That self is exactly why python is an fully object oriented language and everything is an object as opposed to what you said previously!

profomarait
Автор

Chris, nice video.
I suggest you add a couple of things to cover though...
1) access of a class variable from other methods (same class) and the also from outside the class (in the main function)
2) Use of python 'global' to access variables outside class scope

Cheers : )

rodismo
Автор

classes trip me up. thx for the tutorial

darklight
Автор

Thanks Chris, your videos are excellent.

BillWagnerMusicianTurnedDev
Автор

To me the "self" in Python OOP made sense when I began learning OOP. It just clicked for me after I saw an example. . .. It is a place holder for the Object that's going to be created. In your first example, "self" would be "x" when you wrote x=MyClass.

Just thought I'd throw my two sense in there, lol. Maybe it will help someone, maybe not.

Colstonewall
Автор

Great job Chris really like your tutorials!

KevinMThomas
Автор

Forgive me if this is stupid, but I'm really tired right now.

What exactly is the purpose of a class? Can you give me an example of where you'd use it in a code that has an actual purpose?

reziik
Автор

I am sorry to say that your scope explanation is not accurate! There are two scopes there, the local scope in the function and the global one. When scope inside the function is executed a new variable is defined and it is gone once we return from that function; that's why the second call did not "change the scope" because in fact it is another variable that was not touched!

profomarait
Автор

which version of visual studio are you using sir?
@Chris Hawkes

NamanSeth
Автор

Am I the only one who doesn't like python syntax? I used to program in C++.

afelfemale