Issue 10460: Misc/indent.pro does not reflect PEP 7 (original) (raw)

Issue10460

Created on 2010-11-19 14:52 by Mick.Beaver, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg121526 - (view) Author: Mick Beaver (Mick.Beaver) Date: 2010-11-19 14:52
Hello, I noticed that the indent.pro in Misc seems very different from PEP 7. Would it be possible to have one that produces C code that meets the PEP 7 style guidelines? As always, thanks for all of the hard work for Python! -Mick
msg121617 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-11-20 11:47
Done in r86561. Thanks for the report!
msg121646 - (view) Author: Mick Beaver (Mick.Beaver) Date: 2010-11-20 14:00
Georg, Thanks for looking at this. Before getting your response, I decided to take a crack at it and came up with something different. We explicitly disagree on: 1. You had --no-blank-lines-after-declarations, but PEP 7 says: - Function definition style: function name in column 1, outermost curly braces in column 1, blank line after local variable declarations. 2. You had --cuddle-else, but PEP 7 has the following listing: if (mro != NULL) { ... } else { ... } I merged our two indent.pro files. Between the two of us, we had a number of switches that were inferred, and should probably be made more explicit in PEP 7. Those are: --braces-on-struct-decl-line --comment-indentation25 --swallow-optional-blank-lines How do you feel about the following indent.pro?: --blank-lines-after-declarations --blank-lines-after-procedures --braces-after-func-def-line --braces-on-if-line --braces-on-struct-decl-line --break-after-boolean-operator --comment-indentation25 --comment-line-length79 --continue-at-parentheses --dont-cuddle-do-while --dont-cuddle-else --indent-level4 --line-length79 --no-space-after-casts --no-space-after-function-call-names --no-space-after-parentheses --no-tabs --procnames-start-lines --space-after-for --space-after-if --space-after-while --swallow-optional-blank-lines -T PyCFunction -T PyObject Thanks for your help, Mick
msg121649 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-11-20 14:09
ad 1: yes, that makes sense. ad 2: "cuddling" and "non-cuddling" else are actually pretty evenly mixed in the source. I didn't explicitly look at PEP 7 for this, but in that case it should get preference. Your suggested profile looked good, applied in r86564.
History
Date User Action Args
2022-04-11 14:57:09 admin set github: 54669
2010-11-20 14:09:19 georg.brandl set messages: +
2010-11-20 14:00:46 Mick.Beaver set messages: +
2010-11-20 11:47:37 georg.brandl set status: open -> closednosy: + georg.brandlmessages: + resolution: fixed
2010-11-19 14:52:46 Mick.Beaver create