Checking your account

You can read the lesson while its saved answers and constructions load. Learning controls will open once that work is ready.

Functions with Clear Responsibilities

Python Function Interfaces

BOTIE

Reusing a routine becomes difficult when calling it also changes unrelated state. The Zen of Python, recorded in PEP 20 in 2004, favors explicit and simple designs. Those principles give us a useful question for a helper: can a caller understand what it needs and what it changes?

Python's argument system lets a function make dependencies explicit, including keyword-only options. Separating a calculation from its surrounding effects is a design choice built with those language features. It allows a report writer and a web page to reuse the same result without inheriting each other's printing or storage behavior.

Sources for this history