7 Approaches to Validate Class Attributes in Python

Spot the error before it’s too late

Xiaoxu Gao
Towards Data Science
6 min readNov 30, 2020

--

Photo by Jeswin Thomas from Unsplash

Generally speaking, type checking and value checking are handled by Python in a flexible and implicit way. Python has introduced typing module since Python3 which provides runtime support for type hints. But for value checking, there is no unified way to validate values due to its many possibilities.

--

--

I’m a Developer with a focus on Python and Data Engineering. I write stuff to talk to myself and the world. You can find me on linkedin.com/in/xiaoxugao/.