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

Switch from range(len(...)) to enumerate(...) #82

Merged
merged 1 commit into from
Jul 13, 2022
Merged

Switch from range(len(...)) to enumerate(...) #82

merged 1 commit into from
Jul 13, 2022

Conversation

ThibFrgsGmz
Copy link
Contributor

Originating Project/Creator
Affected Component
Affected Architectures(s)
Related Issue(s) void
Has Unit Tests (y/n) n
Builds Without Errors (y/n) Let CI run
Unit Tests Pass (y/n) Let CI run
Documentation Included (y/n) n

Change Description

This PR aims to switch from range(len(...)) to enumerate(...) to access the counter and the value from the iterables at the same time.

Rationale

It is not Pythonic to use range(len(...)). Index based loops do not exist in Python, it uses collection iterators instead.

Python includes an enumerate method to add a counter to an iterator. This method allows you to access both the counter and the value of the iterator at the same time. It is therefore recommended to replace range(len(...)) with enumerate(...).

Testing/Review Recommendations

void

Future Work

void

Copy link
Collaborator

@LeStarch LeStarch left a comment

Choose a reason for hiding this comment

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

Looks good!

@LeStarch LeStarch merged commit ac1b669 into nasa:devel Jul 13, 2022
@ThibFrgsGmz ThibFrgsGmz deleted the feat/implicit_enum_calls branch August 19, 2022 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants