Attribute Tips
Learn how to hide attributes from the outer world in Python.
We'll cover the following
Hide everything
One of the often-overlooked aspects of encapsulation is hiding instance attributes, or restricting direct access to an object’s inner machinery. Hidden attributes can’t be modified directly, which protects them from inconsistent modifications, both incidental and intentional. For example, if a class contains the radius of a circle and its area, we cannot change either attribute without changing the other:
Get hands-on with 1400+ tech skills courses.