Raising errors in a comparison operator is pretty uncommon. I would remove this assert and move them in the condition below. What do you think?