-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[pep-8] Prefer "foo is None" to "foo == None". Prefer "foo not in bar" to "not foo in bar". #9581
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
Conversation
In accordance with Style Guide for Python Code (PEP 8): * https://www.python.org/dev/peps/pep-0008/#programming-recommendations
|
@practicalswift See the pep-8 discussion in #6156. As well as the (clang-format) discussion in #6839 (similar to these kind of changes). If your going to do this, please combine all your changes into a single pull request. Then a more general discussion can happen about wether this is something we even want to do. As soon as you start half-enforcing style/formatting, you can just end up with "fix-up" pull-requests ever 2 weeks; while continuously breaking patches etc. Multiple single commit pull requests that only change formatting/styling/trivial things etc are not preferred, as each one requires review, and generates noise in an already pull-request flooded (with not enough people reviewing) repository. Contributions are always welcome, but please be mindful of the workload you could be creating for others (especially so close to a feature freeze). If possible, combine batches of smaller, related changes into single pull requests. If needed, a single important change can always be broken out, as already happens with the back-porting we do. |
In accordance with Style Guide for Python Code (PEP 8): * https://www.python.org/dev/peps/pep-0008/#programming-recommendations
|
@fanquake PRs now combined as requested. I totally agree that PEP-8 changes pertaining to whitespace, etc is overshooting. With regards to PEP-8 compliance my suggestion is to keep it to fixing only really obvious non-Pythonic things such as comparing to Basically what @MarcoFalke outlined in this comment:
Sounds good? :-) |
|
We should focus on stuff that is causing issues or is know to be
likely to cause issues and not things that are merely coloring issues
of the bike.
For example there were a lot of issues in the python2 version of the
rpc test, such as bare `except:` clauses with a `pass` in the body of
the except clause, which makes the test pass regardless of what
happens. This is obviously not something we want. Luckily, I fixed all
of those when switching to python3.
|
|
@MarcoFalke Good points! These two changes specifically - avoiding |
|
Is this one of interest or should I close it? :-) |
Prefer
foo not in bartonot foo in bar.In accordance with Style Guide for Python Code (PEP 8):