-
Notifications
You must be signed in to change notification settings - Fork 134
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
Tidy Code To Follow PEP8 and work with FLAKE8 #106
Conversation
Hey, thanks for this work! |
Ok! Give me a heads up before the 2.7.2 release so I can re-tidy the code. |
Hi @Richienb, thanks for this PR. I don't believe we can accept this as it is. I would guess this has been done with autopep8 or similar, as it's an inhuman amount of work otherwise. The difficulty with automating "style" is that machines have very little sense of what conveys meaning best to humans. Humans, however, have to review things before we commit them. PRs that take this in smaller chunks are more likely to be reviewed. At first I thought this was all white space change, which ought to be harmless, and I started to write a reply about where we should and shouldn't be glad of such style adjustments (mostly ok in our Jython-specific code, not ok in code we have borrowed). However I noticed that the tool hasn't confined itself to white space, and has done some things that make me wonder if you are processing the code as Python 3. Here are examples:
There are lots more. So we definitely couldn't commit this as it is. Back with the question of style, some of this change is good. In particular, I think this does a lot of good to the readability of the demo material, fixing indents and removing the hard tabs, and looks harmless. (Some of these demos don't work anymore, and maybe should go, but that's another issue.) It is worth reading this: PyCQA/pycodestyle#466, and what PEP 8 itself has to say about the hobgoblin of small minds. Machines are great at consistency, which often helps readability. PEP 8 allows a range of styles. This is enforcing a certain set of rules, that are somebody's, yours or the tool authors'. It's not always an improvement. This is definitely less readable: Anything in the Here's what I think might be useful if I haven't put you off contributing ... If you could clarify the Python 2/3 question (see Flake8 manual), a PR focusing just on the demo material is likely to be accepted easily. PRs addressing files ending |
Thanks Jeff, for having a closer look than me. When I wrote my reply I had only skimmed through the first few files, which were the demos and looked quite good. What you say makes perfect sense. |
First of all, yes I did use AutoPEP8 and Autoflake. Thanks for telling me what's wrong. I'll work on a more suitable fix very, very soon. |
Thanks @Richienb. I think you have a good scope for the PR now and I'll review it, merge it if I can. We don't (yet) manage Jython on GitHub, only mirror a Mercurial repository. So I'll export this as a patch, apply it there, and it will come back to you as a single change set on the Jython master. I will have to tinker with it because something slightly odd has gone on in this PR such that it forward-and-reverse patches a lot of files, and in the process draws in some changes others have made to Jython since your fork. Maybe you copied files from a tip checkout into your own repo as a way of reverting? Git has better ways to manage this using branches, but I won't try to remember them here: I always look in the Git Book before I do anything more complicated than a simple commit. Anyway, the usual thing to do after forking is to create a branch named after the issue/PR, which makes it easier to abandon or start over. If my tinkering is not successful I'll ask you to re-work it that way (as a new PR). If you fancy doing similar work on other groups of our Python files, you'd be welcome, but please take that approach: a named branch starting at a change set we have in common (not one only on your current "master"), and a new PR. |
The commit I just created is to resolve a file conflict. |
@Richienb: In the end, it was easiest to merge the Demo folder from your repo and credit you in my check-in. You are now immortalised at: Thanks again. |
I'm happy to be a contributor to Jython. Thank you. |
Tidied the code to follow the PEP8 specification and FLAKE8.