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

Various code style improvements, mainly to TaxBrain views #903

Merged
merged 2 commits into from Jun 14, 2018

Conversation

lucassz
Copy link
Contributor

@lucassz lucassz commented Jun 14, 2018

Various suggestions for changes to the TaxBrain views file, mainly to meet PEP8 guidelines and for general cleanup. Also, some list comprehensions are changed to generator expressions. I'm looking forward to feedback about whether these are too many or too few changes for this purpose.


if all([j == 'YES' for j in jobs_ready]):
if all((j == 'YES' for j in jobs_ready)):
results = dropq_compute.dropq_get_results(normalize(job_ids))
Copy link
Collaborator

Choose a reason for hiding this comment

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

@lucassz what's your motivation for using a tuple instead of a list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a generator expression, which should be more efficient. In this case, it can fail quicker, if one item is not 'YES', without needing to generate the whole list. Although, now that I look at the spec, it seems as though the second set of parentheses isn't needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, neat. Yep, looks like you don't need the second-set of parentheses.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the explanation.

@hdoupe
Copy link
Collaborator

hdoupe commented Jun 14, 2018

LGTM, thanks for the contribution @lucassz

@hdoupe hdoupe merged commit 20a4366 into ospc-org:master Jun 14, 2018
@lucassz lucassz deleted the codecleanup branch June 15, 2018 13:32
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