[issue3004] Bug in slice.indices()

2008-06-20 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Committed, r64426. Thanks for the report, Arnaud. -- status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue3004] Bug in slice.indices()

2008-06-20 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Looks like a straight-forward patch. -- assignee: rhettinger -> marketdickinson resolution: -> accepted ___ Python tracker <[EMAIL PROTECTED]> ___

[issue3004] Bug in slice.indices()

2008-06-20 Thread Raymond Hettinger
Changes by Raymond Hettinger <[EMAIL PROTECTED]>: -- assignee: marketdickinson -> rhettinger nosy: +rhettinger ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue3004] Bug in slice.indices()

2008-06-20 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: > 0 <= start <= stop <= lengthif step is positive, and > length-1 >= start >= stop >= -1 if step is negative. That should be: 0 <= start <= length and 0 <= stop <= length (step > 0), and length-1 >= start >= -1, length-1 >= stop >= -1 (

[issue3004] Bug in slice.indices()

2008-06-20 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Here's a new patch that incorporates Arnaud's fix and tests, together with a few extra tests. While I expect that this change will affect very little code, I think it's the right thing to do, because: - start and stop are now processed id

[issue3004] Bug in slice.indices()

2008-06-20 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Sorry: looks like I messed up that last post. The example should be: >>> slice(10, 10, -1).indices(10) # expect (9, 9, -1) (9, 10, -1) ___ Python tracker <[EMAIL PROTECTED]>

[issue3004] Bug in slice.indices()

2008-06-20 Thread Mark Dickinson
Changes by Mark Dickinson <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file10669/unnamed ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue3004] Bug in slice.indices()

2008-06-20 Thread Mark Dickinson
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.assertEqua

[issue3004] Bug in slice.indices()

2008-06-18 Thread Arnaud Bergeron
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)) If yes, test_slice.patch a

[issue3004] Bug in slice.indices()

2008-06-17 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Could you provide some tests for the fixed behaviour? I'll try to check this in (with appropriate tests) after the beta. -- assignee: -> marketdickinson ___ Python tracker <[EMAIL PROTECTED]>

[issue3004] Bug in slice.indices()

2008-06-09 Thread Arnaud Bergeron
Arnaud Bergeron <[EMAIL PROTECTED]> added the comment: Don't blame me for the delay, I have long days (yes, really up to 96 hours long :) As for the documentation patch, I'm not certain anymore about it. Unless I bloat the description to about one full screen worth of text, there will always be

[issue3004] Bug in slice.indices()

2008-06-05 Thread Arnaud Bergeron
Arnaud Bergeron <[EMAIL PROTECTED]> added the comment: It's for code that I am developping. I developped a class to allow full slicing over iterators (like what islice does, but with negative indexes). When I have a positive step I just foward the call to isclice using slice.indices() to comput

[issue3004] Bug in slice.indices()

2008-06-05 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: I agree that those -1s should really be 0s. Do you have any examples of real-life code that's affected by this bug? It doesn't seem like something that would be a problem in practice. -- nosy: +marketdickinson priority: -> normal

[issue3004] Bug in slice.indices()

2008-05-29 Thread Arnaud Bergeron
New submission from Arnaud Bergeron <[EMAIL PROTECTED]>: When calling the indices method of a slice object with a negative stop larger in absolute value than the length passed, the returned stop value is always -1. It should be 0 when the step is positive. Current behavior: >>> slice(-10).indi