-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make slice deletion consistent with standard lists, fixes #12 #14
Conversation
Thanks for this PR, @wetneb. The tests look good. I'd like to take some time to review the |
Yeah, I wish I could have come up with a simpler implementation. Feel free to suggest another version if one comes to mind. |
The PR is here: johnsyweb/python_sparse_list#14 Once this is merged and released as sparse_list one may revert this commit.
It is definitely more readable, but your implementation has higher asymptotic complexity: O(n m) where n is the number of items in the list and m the number of indices to delete, while mine is O(n + m). If having complexity O(n m) is not a problem for you I would rewrite your version to use comprehensions as it would probably speed things up a bit. |
Awesome! It is much more readable like that. |
Great! Thanks for your contribution! |
@johnsyweb if you get a chance to release this, it would be useful as it would enable django-haystack/django-haystack#1682 to move forward. |
0.8 is now available from https://pypi.org/project/sparse-list/ and https://github.com/johnsyweb/python_sparse_list/releases . |
@johnsyweb thanks a lot! Interestingly it looks like it is not possible to install it for Python 2.7, probably because only a "wheel" distribution was uploaded to PyPI and not a .tar.gz. Since django-haystack is compatible with Python 2.7 it would be useful to make it available for this version of Python as well. |
Hmmm...
Will have another try tonight. |
Basic auth works (previously I was using an API key) but you'll need % python3 -m twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Uploading sparse_list-0.8.1-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 11.8k/11.8k [00:02<00:00, 5.57kB/s]
Uploading sparse_list-0.8.1.tar.gz
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10.7k/10.7k [00:01<00:00, 7.97kB/s] |
@johnsyweb Can you file an issue at https://github.com/pypa/warehouse/issues with as much detail as possible? If you could attach the original 0.8.0 distributions as well that'd be helpful. |
Following up here: my current operating theory is that this is caused by API tokens using the non-normalized name, which specifically causes problems for projects with underscores in their names (e.g., I'll be confirming this and making the relevant fix(es) in a bit. |
This reimplements slice deletion to make it consistent with standard lists. Existing test cases have been adapted to reflect this.
See #12.