Bugs item #1671137, was opened at 2007-02-28 13:58
Message generated for change (Comment added) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1671137&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.6
Status: Open
>Resolution: Wont Fix
Priority: 5
Private: No
Submitted By: Mike Verdone (jyzude)
Assigned to: Nobody/Anonymous (nobody)
Summary: slice obj with no start index is 0 instead of None sometimes
Initial Comment:
Slice objects returned by the slice ":42" return different slice objects
depending on whether the entire slice operation is simple or extended. This bit
of code explains it best:
class SliceBug:
def __getitem__(self, sliceArg):
print sliceArg
s = SliceBug()
s[:42]
s[:42,]
s[:42] produces slice(0, 42, None)
s[:42,] produces (slice(None, 42, None),)
Note that this bug only occurs on classes that do no inherit from object ("old
style" classes). If you change the class to make it inherit from "object" both
slices have None as their start index. Oddly enough in Python 3000 it still
only happens on "old style" classes even though supposedly they are the same as
new style classes. I have also reproduced the bug in Python 2.6, 2.4, 2.3, and
2.2. Seems to be a long standing bug/feature.
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2007-04-02 14:11
Message:
Logged In: YES
user_id=80475
Originator: NO
Fixing this small inconsistency has very little upside but runs the risk
of breaking code that has been running fine for years. I think we should
punt. If you agree, please close this bug report.
----------------------------------------------------------------------
Comment By: Mike Verdone (jyzude)
Date: 2007-02-28 14:04
Message:
Logged In: YES
user_id=584997
Originator: YES
Correction! This is fixed in Python 3000. I just have too many windows
open and too many branches checked out.
File Added: slicebug.py
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1671137&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com