Do Pythonistas Understand Data Abstraction?
I was just reading this page on why not to use getter and setter functions in Python, and realized the author doesn't seem to have any idea what data abstraction is: "In Java, you have to use getters and setters because using public fields gives you no opportunity to go back and change your mind later to using getters and setters." This was never the reason I used a getter or setter method in Java! You use getters and setters to achieve data abstraction : "The representation details are confined to only a small set of procedures that create and manipulate data, and all other access is indirectly via only these procedures." I had a class GridAgent where the agent held its position on a grid, among other things. But then I wanted to re-do this, so that the position was held in a cell, which held the agent. I had (sometimes) done things the "Pythonic" way, but just accessing the position variable, and of course I had to find every instance of th...