From: <no...@so...> - 2000-12-12 09:00:41
|
Bug #122800, was updated on 2000-Nov-18 10:54 Here is a current snapshot of the bug. Project: Jython Category: Core Status: Closed Resolution: Wont Fix Bug Group: None Priority: 1 Submitted by: bckfnn Assigned to : nobody Summary: __getslice__ bug Details: __getitem__ has a bug at boundaries. Example: >>> "012345"[-100:-100:-1] '0' # should be '' The problem appears to be in getStop and(?) getStart in PySequence. These functions should return values in [0,length] for positive steps and [-1,length-1] for negative steps. Currently, getStart always returns values in [0,length] and getStop returns values between [0, length] and [-1, length] for positive and negative values of step respectively. I believe the above problem is due to getStart, and I haven't found a problem related to getStop, but it probably wouldn't hurt to fix it too... Follow-Ups: Date: 2000-Dec-12 01:00 By: bckfnn Comment: I'm not sure what this example should return. When looking at NumPy, I get Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32 >>> from Numeric import array >>> a = array([0, 1,2,3,4,5,6,7,8]) >>> print a[::-1] [8 7 6 5 4 3 2 1 0] >>> print a[-100:-100:-1] [0] It seems like a huge negative start value is interpreted as starting at 0. Based on this, I'm going to close this bug. ------------------------------------------------------- For detailed info, follow this link: http://sourceforge.net/bugs/?func=detailbug&bug_id=122800&group_id=12867 |