Conversation
This is a problem since it causes rapid cycling
Cjkjvfnby
left a comment
There was a problem hiding this comment.
Thank you for improving it.
Changes look good, I left some cosmetic comments.
As for making _Item mutable, Immutability gives extra protection in exchange for performance. In this abstract case, I don't have any strong preference, both versions are fine.
|
|
||
| # Test resize down when sparse | ||
| ## Setup: resize up | ||
| >>> hm = HashMap(100, capacity_factor=0.75) |
There was a problem hiding this comment.
Can we go with size 4? In that case, we could avoid the loop.
There was a problem hiding this comment.
Something like this?
# Test resize down when sparse
## Setup: resize up
>>> hm = HashMap(4, capacity_factor=0.75)
>>> len(hm._buckets)
4
>>> hm[0] = 0
>>> hm[1] = 1
>>> hm[2] = 2
>>> len(hm._buckets)
4
>>> hm[3] = 3
>>> len(hm._buckets)
8
## Resize down
>>> del hm[3]
>>> len(hm._buckets)
8
>>> del hm[2]
>>> len(hm._buckets)
4I've checked that it passes, but I don't know which one I prefer
There was a problem hiding this comment.
I'd prefer to keep tests as linear as possible.
There was a problem hiding this comment.
Let's wait for the 3d opinion.
Co-authored-by: Andrey <Cjkjvfnby@gmail.com>
Thank you for the revision!
I understand that the immutable version is faster. That said, performance will be limited in Python either way |
|
Changes look good. I'll not be active for the next 2 weeks, please don't wait for me. |
Please refer to the commit messages for a detailed breakdown of the changes.
Feedback from the original author, @Cjkjvfnby, would be greatly appreciated!
Describe your change:
Checklist: