When I teach about Python decorators, I often use the extended metaphor of "being abducted by a UFO".
In science fiction, the abductee is subtly or not so subtly transformed by the abduction experience. What's important is they come back as still themselves, which parallels decorated callables retaining their original names.
In the video below I'm using the @property decorator to show how a Circle type might update its inter-related attributes through setter method calls behind the scenes.
In science fiction, the abductee is subtly or not so subtly transformed by the abduction experience. What's important is they come back as still themselves, which parallels decorated callables retaining their original names.
In the video below I'm using the @property decorator to show how a Circle type might update its inter-related attributes through setter method calls behind the scenes.