It’s like the old Python 2
cmp built-in function: it returns 1 if it’s larger than the other, 0 if they are equal, -1 if it’s smaller than the other.
Basically, the output of
fn1 > fn2 is the same as
fn1.compareTo(fn2) > 0, when replacing
> with any comparison operator of choice.
However, there’s no good reason to not simply use the
< operators directly if you need to compare filenames.
The comparison operators just do a string comparison of
str(filename)). This also applies to
I’m not actually really sure why
compareTo exists, I think for a while interrogate needed it to be able to generate a Python 2 comparison function, but this hasn’t been the case for a long time since Python 2 got rich comparison operators.
I would suggest that you avoid
compareTo unless you really need to know whether it is equal and what kind of inequality it is in one operation.