+ 2
How can we provide security if there is no access specifiers in python??
As private and protected members can be accessed by using class name outside the class .
3 Answers
+ 3
There is no such thing as privacy in Python. You just use underscores to declare the variables as private so that they could not be directly modified outside the class. But actually you can do that using the class name as you said.
This is generally called name mangling and used so that the variable does not clash with another variable in a sub class.
__variable is replaced with-
_className__variable
Here is small code demonstration.
https://code.sololearn.com/cN3CJ80EyerJ/?ref=app
+ 7
security... who needs security????
The security is the experienced coder.
Best are those, who already had a big crash with itđđ
Sounds funny but has a lot if truth in it.
+ 4
Private and protected members can't be accessed *directly* outside the class.