It's virtually the same in Python if you wrote it explicitly:
def <=>(other)
[major, minor, patch] <=> [other.major, other.minor, other.patch]
end
vs:
def __lt__(self, other):
return (self.major, self.minor, self.patch) < (other.major, other.minor, other.patch)
Then use the `total_ordering` decorator to provide the remaining rich comparison methods.
That said, it's a little annoying Python didn't keep __cmp__ around since there's no direct replacement that's just as succinct and what I did above is a slight fib: you still may need to add __eq__() as well.