+ 1

Does Python support encapsulation?

It Depends on how you describe Encapsulation.

26th Feb 2018, 8:19 PM
Azeem Ghafoor
Azeem Ghafoor - avatar
3 Answers
+ 5
In Python private member can be accessed from outside. For me this is not encapsulation.
26th Feb 2018, 8:30 PM
Oma Falk
Oma Falk - avatar
+ 1
When the Programming was started, initially the importance was given to the logic (code or functions). But as the projects grew bigger and bigger, that idea lead to lot of redundant code/modules and maintainability became a big problem. So people shifted the importance to data and the functions are understood as the pieces of code operates on data. So, they were logically able to group the functions. That is how OOP paradigm came into existence and became widely popular. The idea of encapsulation can be understood as "binding up of data and the functions acting on those data, as a single entity". This is the fundamental building block of OOP programmin. That idea is implemented in most of the languages as Class. Python does support Object oriented programming paradigm as well.
26th Feb 2018, 8:20 PM
Azeem Ghafoor
Azeem Ghafoor - avatar
+ 1
please define encapsulation in your words so i could get your point
26th Feb 2018, 8:36 PM
Azeem Ghafoor
Azeem Ghafoor - avatar