Inspecting the slice
class in Python with dir()
, I see that it has attributes __le__
and __lt__
. Indeed I saw that the following code works:
slice(1, 2) < slice(3, 4)
# True
However, I cannot see which logic is implemented for this comparison, nor its usecase. Can anyone point me to that?
I am not asking about tuple comparison. Even if slice and tuple are compared the same way, I don't think this makes my question a duplicate. What's more, I also asked for a possible usecase of slice comparison, which the suggested duplicate does not give.