-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
[Question]: Why is FURB131 good in this case? #234
Comments
Maybe a small addition: I do like |
When used on it's on (as a statement), And yes, the Also, there are explanations for each of the checks, and you can access them via |
To start
Separating them might be a simple fix. Is it possible to add a new rule?
I fundamentally disagree with the idea that you should warn about something because it might, in rare instances, when the programmer is an absolute noob, lead to unpythonic code. It doesn't even catch bugs, apart from maybe some contrived cases. If you want developers to know about
It might be easier to just warn everyone, but the more I think about it, the more sure I am, that the better decision is to make that rule opt-in or deprecate it apart from the aforementioned exception ( I would say that in most cases when someone is actually doing
The both examples you named show why
I obviously looked at the explanation but find it pretty disturbing: For the first two cases, I would probably swap the good and bad example. And the reasoning is very vague: That you can use In essence, I think the best solution might be to implement the "correct" intention. Which is |
This is more of a meta thing (so it's a separate comment):
What does "backwards compatible" mean? Anyway, if you have a library like this, that has a lot of partially subjective, and a lot of unfinished or suboptimal rules (what I called controversial), you have to be able to make rapid changes for a good user experience IMO. |
This PR removes a portion of FURB131 which suggested replacing most instances of `del` with `.pop()`. The reasoning behid it was not well founded, and in most cases, it is better to just leave the `del` statememt as it is. In one instance though, which is the `del x[:]` usage, it is more preferable to use the `.clear()` method, as it is faster and more readable. Closes #234.
This PR removes a portion of FURB131 which suggested replacing most instances of `del` with `.pop()`. The reasoning behid it was not well founded, and in most cases, it is better to just leave the `del` statememt as it is. In one instance though, which is the `del x[:]` usage, it is more preferable to use the `.clear()` method, as it is faster and more readable. Closes #234.
Overview
I have the following code:
Refurb tells me to change it to the following
I don't understand why I should use pop. IMO,
pop
anddel
have a very different meaning:pop
means I want to use the valuedel
means I want to delete the value but explicitly not use itCould you maybe explain your reasoning?
Proposal
My proposal would be to remove 131. But you probably have a good reason, so this is rather a question than a proposal.
Apart from that, I would love a wiki or documentation that explains some more controversial design decisions.
I believe that is part of any linter/formatter/type checker, even if it requires a lot of effort. Maybe you could use the GitHub wiki (preferably) or GitHub Pages
The text was updated successfully, but these errors were encountered: