A well-made class lets the outside world do what it should, and keeps the rest to itself. That idea is called encapsulation, and it means you can change how a class works inside without breaking the code that uses it. Python does it with conventions and with properties, which let a plain-looking attribute run code when it is read or set. This lesson shows both, and why Python programmers rarely write getters and setters.
More lessons in Complete Python Programming