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
Pep8-compliance, lattices.py as an example #24076
Comments
Branch: u/jmantysalo/pep8-lattices |
comment:2
Frédéric, you might be interested in this. What should we do to
I admit that it is not beatiful, pep8 got it right with E129. Another thing, is |
Changed branch from u/jmantysalo/pep8-lattices to none |
Branch: u/jmantysalo/pep8-lattices |
comment:4
Replying to @jm58660:
IMO, I wouldn't change this.
IMO, we should not be too strictly PEP8, which IIRC allows for breaking things for readability. Also, while we are at it: -if isinstance(data, FiniteMeetSemilattice) and len(args) == 0 and len(options) == 0:
+if isinstance(data, FiniteMeetSemilattice) and not args and not options: |
Commit: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:7
I changed those Now we have following pep warnings:
Long lines are mostly impossible to avoid. As for E201/E202 I think it adds readability to use spaces in a long line where outer parentheses are used for line continuation, like
What about lambda expressions? Is there a real reason to use |
comment:8
Replying to @jm58660:
Yep, we just do what we can (and for readability of code, somethimes it is better, IMO, to break the limit).
I agree; leave them be.
Well, a lambda function should be anonymous, so you should not assign it a (variable) name. It is mostly equivalent to the |
comment:9
Replying to @tscrim:
Ah, that was what pep8 complains. First of all, there may be places where a lambda is used more than once. This is not case here. But still, to me
seems easier than
Hence I mark this as needs_review. For the future it could be nice to pep8-check modified lines, i.e. combine the output with the output of |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
New commits:
|
comment:12
Arghs, errors with git... |
comment:14
Replying to @jm58660:
Resolved, hopefully... |
comment:15
I'd like to clarify the purpose of this ticket: is it just an investigation of how pep8 should be applied to "real Sage code" so that we can put appropriate guidelines into the developers guide? That's fine, but I am very much against large scale change of code just for the sake of following guidelines - it does make it harder to track down where certain lines of code are coming from using blame. Using some script to check NEW lines of code in patches to make sure that future additions/modifications are following good practices is of course a different (and nice) thing. |
comment:16
That's a good point about |
Reviewer: Travis Scrimshaw |
comment:17
Currently we have "Follow the standard Python formatting rules when writing code for Sage - - pep-0008" in the devel manual. From this experience I would say that at most we should add something to soften the tone. ", if there are no special reason to do otherwise." or similar. Maybe nothing.
More general: Should we have more visible way to automatically say "Hey! Please check this!" to a developer from trac? We can not reject the code for being not-pep8-compliant, but we could ask for confirmation. |
Changed branch from u/jmantysalo/pep8-lattices to |
This patch nominally tries to pep8fy
lattices.py
. The real question is discussion about pep8.CC: @fchapoton
Component: combinatorics
Author: Jori Mäntysalo
Branch/Commit:
8199a58
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/24076
The text was updated successfully, but these errors were encountered: