-
Notifications
You must be signed in to change notification settings - Fork 300
PEP8 updates #2174
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 updates #2174
Conversation
|
Hi @QuLogic i think this is a positive step, i am in favour I had not realised that pep8 explicitly pushed against lambda functions in the way this PR suggests have you considered whether we should adopt this pattern within the user guide? e.g. or is the key pep8 suggestion that multi line lamda functions are naff, rather than all lambda functions? |
PEP8 suggests you prefer a
The user guide is suggesting ways of doing things to end users, and as such I don't think we need to be strict about following a style document there (it is the end user's decision what style to follow, if any). |
| # A dramatic speedup can be had if we don't have bounds. | ||
| if coord.has_bounds(): | ||
| call_func = lambda cell: cell in desired_values | ||
| def call_func(cell): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a one-liner like the original:
def call_func(cell): return cell in desired_valuesAny strong preferences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i find reading over multiple lines clearer than having a def and func on one line, I prefer @QuLogic 's current, I think
|
all the individual code changes seem positive or neutral to me the overall aim of unpinning is clearly better I see no reason not to merge last call for caution..... |
|
please may you also add a change to thank you |
This warning is not a major problem, but most of the code is already styled in this manner.
This is "E731 do not assign a lambda expression, use a def" in pep8; in many cases, it is quite right to complain, especially with multi-line lambdas.
Due to conditional imports and such, this happens a few times and is annoying to ignore at each location.
|
excellent, many thanks @QuLogic |
The
pep8package was pinned in #1558. To be able to run on the latest packages, this pinning needs to be removed. So these style issues need to be corrected as well.On a related note, when should we depend on
pycodestyleinstead ofpep8?