Skip to content

Conversation

fchapoton
Copy link
Contributor

@fchapoton fchapoton commented May 28, 2023

📚 Description

This fixes some E275 warnings (E275 missing whitespace after keyword) plus a few other things

outside of graphs, rings, misc, coding and combinat for now

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@@ -400,10 +400,10 @@ def some_elements(self):
points = []
R = self.base_ring()
for i in range(self.ambient_dim() + 5):
points.append([R(i*j^2) for j in range(self.ambient_dim())])
points.append([R(i * j ^ 2) for j in range(self.ambient_dim())])
Copy link
Contributor

Choose a reason for hiding this comment

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

This spacing is a bit much for my taste. Wouldn't i * j^2 conform to the spec too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am afraid not. Also, I am not sure if XOR is really the intended thing here. changing it to ** breaks some doctests though

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, right, this is XOR there. So spacing that agrees with precedence would be i*j ^ 2

Copy link
Contributor

Choose a reason for hiding this comment

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

(This expression has been there since the very beginning; 7e02dce)

Copy link
Contributor

Choose a reason for hiding this comment

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

https://peps.python.org/pep-0008/#other-recommendations
"If operators with different priorities are used, consider adding whitespace around the operators with the lowest priority(ies)."

# Correct:
[...]
x = x*2 - 1
hypot2 = x*x + y*y
c = (a+b) * (a-b)
# Wrong:
[...]
x = x * 2 - 1
hypot2 = x * x + y * y
c = (a + b) * (a - b)

@fchapoton
Copy link
Contributor Author

voilà

Copy link
Contributor

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

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

Thank you, looking good.

@github-actions
Copy link

Documentation preview for this PR (built with commit ded1602) is ready! 🎉

@vbraun vbraun merged commit 78e06c7 into sagemath:develop Jun 3, 2023
@fchapoton fchapoton deleted the some_fixes_for_E275 branch July 16, 2023 19:12
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.

3 participants