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
Add slicing support to collections.deque #61596
Comments
Once added, use it in threading.Condition(). |
The slicing support can be implemented using just rotates, appends, and pops. |
What type should be a result of slicing? List, tuple, deque, other? |
For the record, Raymond asked for permission to check this in (a new feature) for 3.5 beta 2, as he won't have time to finish it before beta 1. As 3.5 release manager I've given him permission. Go Raymond! |
Proposed patch implements getting, deleting and setting slices in deque. Getting a slice returns a list, but this can be changed if needed. |
Synchronized with current sources and added mandatory now braces. |
Thank you for doing this work. |
It seems odd to have a slice of a deque return a list. Are there any other examples of non-buffer protocol objects behaving like this in the standard library/built-ins? Only examples I can come up with are mmap objects and ctypes arrays (which are making raw binary data available in Python); it seems rather surprising that a Python level type like deque would slice to produce a list. |
Returning a deque is preferred. For this stage, I just want to review the code and make sure it algorithmically correct (slicing is complicated and has a lot of cases). |
Since the patch is so complex, I suggest to split it on parts, and review and commit them separately:
|
I'm already underway for the review. The "refactoring" part is making is more difficult. We just need slicing support to be added. Yes, I do want slice assignment and deletion. The output should be a deque, not a list. |
The output now is a deque. |
Raymond, do you have a time to make a review? |
Raymond, do you still have an interest in this issue? If no, you can just close it. |
Ping. |
Yes, I would rather close this than apply this patch. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: