Using Magic Methods to Control Attributes in Python

Unusual method implementations to control attributes

Stephen Fordham

--

Image courtesy of jeshoots via Unsplash

Primer

We can take advantage of magic methods in Python to control attributes that are being set. In this tutorial guide, I present 3 methods using the call, setattr, and a decorator for the init method as unique ways to control how attributes can be set.

--

--