+ 3
If the class attributes in python are public and can be changed on demand, then how is abstraction achieved in py?
I am learning Oops in py and am confused confused as how will abstraction be achieved if the object's attributes are public and can be easily changed. Also, any class attributes can also be changed. Are the functions private in py?
4 Respostas
+ 3
Scope in Python is very weird and it's something I'm still learning and getting used to.
I have seen that people implement their own way of making abstract classes (since there's no abstract keyword) by making use of the abc package (which stands for Abstract Base Classes and it native to python) and importing a decorator called abstractmethod.
+ 1
There is always a way to manipulate private attributes.it counts for every language.
Init is not public as you see . It is a dunder (__init__)
Other languages say:you must not access private attributes
Python says: you should not
0
Oh okay, clearer now. Thanks Oma Falk sir.