Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
at this timechunk_len
represents the length of the last chunk that was "popped" and not the last chunk in chunks, but who knows, maybe that's a good thing? just need to add more tests with #273 and if it works then that's fineon closer look, this is fine, because of
if chunks
predicate that this only tests true on the break statement in the while loop, looks like a fine optimization, thanks!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.
I was expecting the linter to complain since
chunk_len
is defined within the while loop. I'm not sure if it's smart enough to know it's guarded or what, but it's not complaining.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.
I don't think the linter will catch it. mypy will complain about it - but that's because mypy doesn't understand the
if chunks
aspectThere 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.
mypy ran fine
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.
As for the dubious use of
chunk_len
outside of while loop, I've opted to incorporate the performance enhancement but move it to the inside of while loop in PR #275, thanks!