Python Arena

Module 39

Encapsulation

Keeping objects in a sensible state. Private attributes with two underscores, getters and setters with `@property`, checking new values in a setter, and private helper methods.

Steps

  1. Private attributes
  2. Getters with @property
  3. Setters that check the value
  4. Private methods