Ron Adam wrote: >> This should never fail with an assertion error. You will note that it >> shows that, for non-negative start and end values, slicing behavior is >> _exactly_ like extended range behavior. > Yes, and it passes for negative start and end values as well. Umm, no: .>> for stride in [-3, -2, -1, 1, 2, 3]: ... for start in range(-1,len(L)): ... for end in range(-1,len(L)): ... P = L[start:end:stride] ... Q = [L[i] for i in range(start, end, stride)] ... assert P==Q, [start, end, stride, P, Q] ... Traceback (most recent call last): File "<stdin>", line 6, in ? AssertionError: [-1, 0, -3, [9, 6, 3], []] > Thanks again, this pretty much explains why slices opperate the > way they do. And it explains why the edge case's happen as well I think. You're welcome. Regards, Pat
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4