Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Implement list.__delslice__ #379

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

m4ns0ur
Copy link
Contributor

@m4ns0ur m4ns0ur commented Sep 12, 2017

No description provided.

Copy link
Contributor

@trotterdylan trotterdylan left a 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)
Copy link
Contributor

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?

Copy link
Contributor Author

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]
>>> 

Copy link
Contributor Author

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

@m4ns0ur
Copy link
Contributor Author

m4ns0ur commented Sep 20, 2017

@trotterdylan PTAL

@m4ns0ur m4ns0ur closed this Nov 22, 2017
@m4ns0ur m4ns0ur reopened this Nov 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants