-
Notifications
You must be signed in to change notification settings - Fork 10
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
EC69 : Irrelevant rule for Python code #21
Comments
Agreed, I got bitten by this non-issue yesterday on a work project when activating the eco rules. Is it a failed port of an equivalent rule in another language ? I believe this rule should be simply removed. |
Hi, thank you for your demonstration. I'm ok to check on other language. |
Hello @dedece35. I perform some tests as described in this issue to verify and indeed I think we can remove this rule for Python. |
Rule EC69 is irrelevant for Python. The rule seems to imply that calling a function in a for statement results in calling this function multiple times, which is not true.
The two following syntaxes are strictly equivalent regarding the number of calls to the
range
builtin function :A simple way to prove see this is using a counter :
This prints
2
since the function is called only twice.Therefore, I think the rule should be dropped since it's confusing and doesn't make much sense from an eco-design perspective, at least for Python, but it should be investigated for other languages too.
The text was updated successfully, but these errors were encountered: