
28.05.20 11:02, Ram Rachum пише:
I recently submitted this PR <https://github.com/more-itertools/more-itertools/pull/430/files>, and I had to use assertSequenceEqual twice, just because I wanted to compare 3 sequences to each other rather than 2.
You have wrote much more text in this message that you would save by not typing assertSequenceEqual twice.
Wouldn't it be possible to make assertEqual and its entire family (including assertSequenceEqual and the dozen of other methods) accept an arbitrary number of arguments, and compare all of them to each other? That way I could do this:
self.assertSequenceEqual(sliced_tuple_0, sliced_tuple_1, sliced_range)
As Rémi said, it is breaking change.
We could discuss whether they'll do the faster version of a == b == c, or a more extensive check between every 2 items individually.
Why do you think it will be faster? `a == b == c` is the same as `a == b and b == c`, but a tiny bit slower. You always can write self.assertTrue(a == b == c) But the advantage of two separate assertions is that you know what comparison fails if it fails and get more informative report.