-
Notifications
You must be signed in to change notification settings - Fork 647
Implement list.__delslice__ #379
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like Jenkins upgraded to Go 1.9 so builds are failing. I'll get that fixed.
runtime/list.go
Outdated
} | ||
l.mutex.Lock() | ||
numListElems := len(l.elems) | ||
start, raised := calcIndex(f, args[1], numListElems) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we instead construct a slice and call DelSlice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trotterdylan was thinking same, but some tests are not passing:
--- FAIL: TestListDelSlice (0.00s)
list_test.go:122: TestListDelSlice([1, 2, 3, 4, 5], -1, 3) = [1, 2, 3, 4, 5], want [4, 5]
list_test.go:122: TestListDelSlice([1, 2, 3, 4, 5], 1, -3) = [1, 3, 4, 5], want [1, 2, 3, 4, 5]
from CPython:
>>> x=[1,2,3,4,5]
>>> x.__delslice__(-1, 3)
>>> x
[4, 5]
>>> x=[1,2,3,4,5]
>>> x.__delslice__(1, -3)
>>> x
[1, 2, 3, 4, 5]
>>>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trotterdylan ok, I will keep index alignment before initiating Slice
, it should be enough
@trotterdylan PTAL |
No description provided.