why to use weakly private methods when we can access them easily. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why to use weakly private methods when we can access them easily.

Python single underscore methods.

9th Jul 2016, 9:35 AM
jayrajarora2694
jayrajarora2694 - avatar
1 Answer
+ 2
It is to discourage the use of them, not totally block access to them. Private variables and methods are intended for the use of that class only. Accessing them may cause instances of the class to work differently than intended.
9th Jul 2016, 12:24 PM
Gershon Fosu
Gershon Fosu - avatar