-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ruff
] add fix safety section (RUF017
)
#17480
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
[ruff
] add fix safety section (RUF017
)
#17480
Conversation
|
ruff
] add fix safety section (RUFF017
)ruff
] add fix safety section (RUF017
)
Thanks for this! Looking at the implementation for this rule, I notice that it is only emitted when the user explicitly provides the However, there is a small difference in implementation between So, unless I'm misunderstanding, I think the only thing the fix could do that would change behavior is turn code that used to raise an exception into code that no longer raises an exception. Namely: import functools
import operator
ranges = [range(2), range(3)]
# raises a TypeError
sum(ranges, [])
# evaluates to [0, 1, 0, 1, 2]
functools.reduce(operator.iadd, ranges, []) So maybe we can reword the fix safety section in light of this? |
Hey @dylwil3 Perhaps something on this direction?
Another question: what is the politic with deleted comments? Should this be mentioned in the |
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.
Thank you! Your wording was good - I added it in with some minor corrections.
The PR add the
fix safety
section for ruleRUF017
(#15584 )