On Wed, Jun 18, 2008 at 4:56 PM, Arnaud Bergeron <report@bugs.python.org> wrote:

Arnaud Bergeron <abergeron@gmail.com> added the comment:

Would these do?

self.assertEqual(slice(None,   -10    ).indices(10), (0,  0,  1))
self.assertEqual(slice(None,   -11,   ).indices(10), (0,  0,  1))
self.assertEqual(slice(None,   -12, -1).indices(10), (9, -1, -1))

Perfect.  Thank you.

If this is changed, then I think the following should also be
changed:

>>> slice(10, 10, -1).indices(10)  # expect (9, 9, -1)
(9, 10, -1)

I believe the second index here should be 9, not 10.
Do you agree?

With these two changes the code, while marginally
more complicated, is actually easier to understand than
before, since exactly the same processing is applied
to both the start and stop indices.  I think this is as
it should be.