I still think that the current solution is easier to understand (but of course equivalent with what you are saying).
I agree with the __debug__ part; took that out