I suspect the author may be a bit removed from modern python, as the community is increasingly taking a similar stance. Python is not Haskell, but Python in 2021 with tools like type-hints, mypy, (frozen)dataclasses, Pydantic, etc. is trying to address at least the latter two points here (type-driven & illegal-states-unrepresentable). I'm not aware of ways to enforce function purity in python (do any linters complain about input modification or out-of-scope references?), but I try to make functions as pure as possible regardless of language or domain anyways.
I don't mean this as a flamewar, Haskell seems like the right choice for OP. I love how a language like python is making more of these benefits available to a wider audience and I wish more folks embraced these recent advances.