Mark Dickinson <[EMAIL PROTECTED]> added the comment:
On Wed, Jun 18, 2008 at 4:56 PM, Arnaud Bergeron <[EMAIL PROTECTED]>
wrote:
>
> Arnaud Bergeron <[EMAIL PROTECTED]> 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:
(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.
Added file: http://bugs.python.org/file10669/unnamed
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3004>
_______________________________________
<div class="gmail_quote">On Wed, Jun 18, 2008 at 4:56 PM, Arnaud Bergeron
<<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>>
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Arnaud Bergeron <<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>> added the comment:<br>
<br>
Would these do?<br>
<br>
self.assertEqual(slice(None, -10 ).indices(10), (0,
0, 1))<br>
self.assertEqual(slice(None, -11, ).indices(10), (0, 0,
1))<br>
self.assertEqual(slice(None, -12, -1).indices(10), (9, -1,
-1))<br></blockquote><div><br></div><div>Perfect. Thank
you.</div><div><br></div><div>If this is changed, then I think the following
should also be</div><div>
changed:</div><div><br></div><div><div>>>> slice(10, 10,
-1).indices(10) # expect (9, 9, -1)</div><div>(9, 10,
-1)</div><div><br></div><div>I believe the second index here should be 9, not
10.</div><div>Do you agree?</div>
<div><br></div><div>With these two changes the code, while
marginally</div><div>more complicated, is actually easier to understand
than</div><div>before, since exactly the same processing is
applied</div><div>to both the start and stop indices. I think this is
as</div>
<div>it should be.</div><div><br></div></div></div>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com