Unit 6 reflection/ Codio Encapsulation notes:

Learning about encapsulation makes it useful for me to gain a better understanding of why it is used and why it is important. Essentially, there seems to be an element of restriction to certain parts of data which provides several benefits (such as decreasing the probability of errors/bugs).

Python uses the convention of an underscore to indicate the data being private (encapsulated). However, it’s important to be aware that Python itself still thinks that the data is public; if it were really private, Python would instead print an error message.

References

Philips, D. (2018) ‘The Iterator Pattern’ in: Python 3 Object-oriented Programming. 3rd ed. Packt Publishing.