Skip to content
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

gh-104273: Remove redundant len() calls in argparse function #104274

Merged
merged 1 commit into from May 7, 2023

Conversation

buraksaler
Copy link
Contributor

@buraksaler buraksaler commented May 7, 2023

@bedevere-bot

This comment has been hidden.

@cpython-cla-bot
Copy link

cpython-cla-bot bot commented May 7, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calculating an expression once instead of thrice or more is a common optimization.

@terryjreedy
Copy link
Member

Burak, I am merging this because to me it makes the code a bit clearer. Redundant expressions can raise the question of whether, in this case, indent was changed so that its len could change. I otherwise would agree with 2 other core developers that this does not do enough to be worth merging. So next time, please about a meatier improvement. Or find an actual bug issue.

@terryjreedy terryjreedy changed the title gh-104273: Reduce number of calls to len() gh-104273: Remove redundant len() calls in argparse function May 7, 2023
@terryjreedy terryjreedy merged commit 01cc9c1 into python:main May 7, 2023
22 checks passed
@buraksaler
Copy link
Contributor Author

@terryjreedy thank you for the feedback. I'll try my best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants