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

Adopt PEP-8 for whitespace recommendations #184

Closed
ischoegl opened this issue Aug 10, 2023 · 0 comments · Fixed by Cantera/cantera#1584
Closed

Adopt PEP-8 for whitespace recommendations #184

ischoegl opened this issue Aug 10, 2023 · 0 comments · Fixed by Cantera/cantera#1584
Labels
feature-request New feature request

Comments

@ischoegl
Copy link
Member

ischoegl commented Aug 10, 2023

Abstract

The current style guide for whitespace (per CONTRIBUTING.md) recommends:

  • Use whitespaces to improve code readability (examples: after commas; before and
    after mathematical operators (+/-/*// except ^), binary operators
    (&&/||/...), and comparisons (</>/==/...); before and after equality

does not follow PEP-8 recommendations, i.e.

# Correct:
i = i + 1
submitted += 1
x = x*2 - 1
hypot2 = x*x + y*y
c = (a+b) * (a-b)

and

# Wrong:
i=i+1
submitted +=1
x = x * 2 - 1  # <-- current Cantera style 
hypot2 = x * x + y * y  # <-- current Cantera style 
c = (a + b) * (a - b)  # <-- current Cantera style 

as well as some other discrepancies.

Motivation

The PEP-8 recommendation seeks to improve code readability, so it should be adopted for all coding languages supported by Cantera.

Possible Solutions

Update style recommendations in CONTRIBUTING.md, and use style going forward. Add comment that aggressive substitutions are not encouraged.

References

Python PEP-8 Whitespace in expressions and statements

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

Successfully merging a pull request may close this issue.

1 participant