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

Use the most concise and pythonic way to create dictionaries and lists #56

Merged
merged 2 commits into from
May 23, 2022
Merged

Use the most concise and pythonic way to create dictionaries and lists #56

merged 2 commits into from
May 23, 2022

Conversation

ThibFrgsGmz
Copy link
Contributor

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

Change Description

This PR includes the following change:

  • [Replaces conditional assignment to a variable with an if expression ref
  • Replaces lists created with list() with [] ref

Rationale

Doing it this way has the added benefit of being a small performance improvement:

$ python3 -m timeit "x = list()"
5000000 loops, best of 5: 63.3 nsec per loop

$ python3 -m timeit "x = []"
20000000 loops, best of 5: 15.8 nsec per loop

Testing/Review Recommendations

Let CI run

Future Work

(void)

@LeStarch LeStarch merged commit 5368488 into nasa:devel May 23, 2022
@ThibFrgsGmz ThibFrgsGmz deleted the feat/impr-dict-list-creation branch June 18, 2022 20:20
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