-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix RubricCollector.clear_doc() #456
Fix RubricCollector.clear_doc() #456
Conversation
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.
bors merge
for i, item in enumerate(list(items)): | ||
if item.document == docname: | ||
items.pop(i) | ||
items[:] = (item for item in items if item.document != docname) |
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.
what's the advantage of doing it this way, instead of...
items = [item for item in items if item.document != docname]
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.
(answering self) it modifies the list instad of creating a new one
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 suppose the generator is coerced to a list as well (but I don't know the right Python terminology), while the choice of generator is for being gentle to memory, where the items are created only when needed
Build succeeded:
|
75: Automated pull from `ferrocene/specification` r=tshepang a=github-actions[bot] This PR pulls the following changes from the [`ferrocene/specification`](https://github.com/ferrocene/specification) repository: * ferrocene/specification#456 Co-authored-by: Matthew Woodcraft <[email protected]> Co-authored-by: bors-ferrocene[bot] <87868125+bors-ferrocene[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
I've seen occasional errors like the following on incremental builds:
The following code in
exts/ferrocene_spec/items_with_rubric.py
won't work as intended if it finds more than one item to remove, because the first
pop
will change the positions of the following elements of the list.