PYTHON PROGRAMMING

Python Assertions, or Checking If a Cat Is a Dog

Learn the rules of using assertions in Python — and those of not using them

Marcin Kozak
Towards Data Science
13 min readMar 2, 2023

--

A false assertion should stop you: something is wrong! Photo by Jose Aragones on Unsplash

An assertion is a statement you can use to test an assumption about your program. This short definition is, on the one hand, clear. On the other hand, it’s far from explaining when you should use…

--

--

A full professor, interdisciplinary researcher, data scientist, statistician, Python, R and Go developer, open-source contributor — and a devoted writer