Python Programming: Lesson 38 - Private Variables

Опубликовано: 12 Октябрь 2024
на канале: youmils03
38
0

PLEASE SUBSCRIBE!!!

In the previous lesson (   • Python Programming: Lesson 37 - Garba...  ), we reviewed dunders and investigated ways to treat an instance of a class as though it were an iterable. In this lesson, we review dunders and instance methods, although we continue our discussion to include strongly and weakly private instance variables. Not much new content here, just a 6th opportunity to see OOP concepts. Only two more OOP videos after this one, and only six videos total.

A weakly private instance variable has one underscore between self. and the name of the instance variable. It is discouraged from being used outside of the class in which it is defined. A strongly private instance variable has two underscores between self. and the name of the instance variable. It cannot be used outside the class in which it is defined.

9:28 Review of _lt_ dunder
10:11 Review of _getitem_ dunder
10:41 NEW: Weakly and Strongly Private Variables
18:26 Review of pass Keyword

For information on public and private variables in Java, check out a somewhat equivalent video here:    • Java Programming: Lesson 24 - this, S...  

Ready to talk about class methods and static methods? Check it out here:    • Python Programming: Lesson 39 - Class...   (lesson 39)

Thanks for watching, and PLEASE SUBSCRIBE!!!