-
Notifications
You must be signed in to change notification settings - Fork 76
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
[EC75] [Python] Concatenate Strings in loop can be applied to Python as well #100
Comments
Hi @LordPatate, If we see the error message of EC75 rule, we can observe that the rule is specific for Java because we talk about StringBuilder. By the other hand, this rule is really good for java because the usage of StringBuilder avoid construction of many String objects in memory, thus environment impact TO DISCUSS INSIDE CORE-TEAM : opinion about this new idea ? |
Hi. I'm thinking that using generator expression are generally more efficient than traditional "for" loops in Python and that Python built-ins like the |
The benefits would likely be seen in term of CPU consumption |
@LordPatate, thank you for explanation ... do you have some references documentation or studies about this way of implementation and CPU consumption ? (to reference them in our documentation for future explanations) |
I don't have any references sadly. It's just my intuition, which is why I said it has to be measured |
(TO BE MEASURED)
The Rule EC75 about String concatenation in a loop is said "Not applicable" for Python, but there actually is a way to generate strings that might be a better manner than concatenation in a loop: creating a list of string using a list comprehension then calling the join() built-in.
Non-compliant code example:
Compliant code example:
The text was updated successfully, but these errors were encountered: