Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-21 Thread Zachary Ware
On Thu, Jan 21, 2016 at 11:12 AM, Brett Cannon wrote: > On Wed, 20 Jan 2016 at 23:07 Nick Coghlan wrote: >> - I wasn't aware of that >> requirement, so I've never explicitly checked CLA status for folks >> contributing packaging related PEPs. (And looking at

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-21 Thread Brett Cannon
On Wed, 20 Jan 2016 at 23:07 Nick Coghlan wrote: > On 21 January 2016 at 10:16, Brett Cannon wrote: > > I just checked with Van and we should have CLAs for even PEP > contributors, > > so it will have to go through the same steps as the other ancillary > >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-21 Thread Stephen J. Turnbull
Zachary Ware writes: > It's quite surprising to me, since all (as far as I know) PEPs are > explicitly public domain. I am very much not a lawyer, though :) The reason for any explicit CLA is CYA: you can't be sure that the contributor DTRTs, so the CLA shows that the contribution was

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-21 Thread Steve Dower
dows Phone -Original Message- From: "Zachary Ware" <zachary.ware+py...@gmail.com> Sent: ‎1/‎21/‎2016 9:23 To: "Python-Dev" <python-dev@python.org> Subject: Re: [Python-Dev] Update PEP 7 to require curly braces in C On Thu, Jan 21, 2016 at 11:12 AM, Brett Cannon <b

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-20 Thread Nick Coghlan
On 21 January 2016 at 10:16, Brett Cannon wrote: > I just checked with Van and we should have CLAs for even PEP contributors, > so it will have to go through the same steps as the other ancillary > repositories. We should probably mention that in PEP 1 - I wasn't aware of that

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-20 Thread Brett Cannon
On Tue, 19 Jan 2016 at 19:33 Martin Panter wrote: > On 19 January 2016 at 20:12, Brett Cannon wrote: > > Here is a proposed update: > > > > diff -r 633f51d10a67 pep-0007.txt > > --- a/pep-0007.txt Mon Jan 18 10:52:57 2016 -0800 > > +++ b/pep-0007.txt Tue

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-20 Thread Brett Cannon
On Wed, 20 Jan 2016 at 10:45 Terry Reedy wrote: > On 1/20/2016 12:45 PM, Brett Cannon wrote: > > > > > > On Tue, 19 Jan 2016 at 19:33 Martin Panter > > wrote: > > > > On 19 January 2016 at 20:12, Brett Cannon

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-20 Thread Guido van Rossum
The wording is totally fine! You might still want to revert it and re-commit it so it doesn't look like a mistake when reviewing the log. BTW When can we start using git for the peps repo? On Wed, Jan 20, 2016 at 12:18 PM, Brett Cannon wrote: > > > On Wed, 20 Jan 2016 at

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-20 Thread Brett Cannon
On Wed, 20 Jan 2016 at 14:31 Guido van Rossum wrote: > The wording is totally fine! You might still want to revert it and > re-commit it so it doesn't look like a mistake when reviewing the log. > Sure thing! > > BTW When can we start using git for the peps repo? > Depends

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-20 Thread Terry Reedy
On 1/20/2016 12:45 PM, Brett Cannon wrote: On Tue, 19 Jan 2016 at 19:33 Martin Panter > wrote: On 19 January 2016 at 20:12, Brett Cannon > wrote: > Here is a proposed update: >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-20 Thread Brett Cannon
I just checked with Van and we should have CLAs for even PEP contributors, so it will have to go through the same steps as the other ancillary repositories. On Wed, 20 Jan 2016 at 14:41 Brett Cannon wrote: > On Wed, 20 Jan 2016 at 14:31 Guido van Rossum

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread M.-A. Lemburg
On 19.01.2016 00:20, Brett Cannon wrote: > On Sun, 17 Jan 2016 at 11:10 Brett Cannon wrote: > >> While doing a review of http://bugs.python.org/review/26129/ I asked to >> have curly braces put around all `if` statement bodies. Serhiy pointed out >> that PEP 7 says curly braces

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Maciej Szulik
To add my additional 0.02$ to the discussion. Quite a while ago my coworkers and I agreed to use strict rules regarding code formatting. That idea turned into a formatter we've had committed in the project itself. This forced everyone on the team to use it and thus producing exactly "the same

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Stefan Krah
M.-A. Lemburg egenix.com> writes: > > Currently this thread stands at: > > Make that: > > > +1 > > Brett > > Ethan > > Robert > > Georg > > Nick > > Maciej Szulik > > +0 > > Guido > > -0 > > Serhiy > > -1 > MAL > > Victor (maybe; didn't specifically vote) > > Larry > >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Guido van Rossum
A formatter bot would be quite complicated to introduce without disrupitions of everybody's workflow (remember that we have about half a million lines of C code in the Python repo). If you want to discuss that please start a new thread on python-dev. On Tue, Jan 19, 2016 at 12:22 PM, francismb

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread francismb
Hi Brett, On 01/19/2016 12:20 AM, Brett Cannon wrote: > On Sun, 17 Jan 2016 at 11:10 Brett Cannon wrote: > >> While doing a review of http://bugs.python.org/review/26129/ I asked to >> have curly braces put around all `if` statement bodies. Serhiy pointed out >> that PEP 7

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Gregory P. Smith
On Sun, Jan 17, 2016 at 11:12 AM Brett Cannon wrote: > While doing a review of http://bugs.python.org/review/26129/ I asked to > have curly braces put around all `if` statement bodies. Serhiy pointed out > that PEP 7 says curly braces are optional: >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Ethan Furman
On 01/19/2016 08:56 AM, Jim J. Jewett wrote: That "otherwise" gets a bit awkward, but I like the idea. Perhaps "braces must not be omitted, and should normally be formatted as follows. ... Where other C styles would permit a braceless one-liner, the expression and braces may be moved to a

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Guido van Rossum
Let's not switch to either of those options. Visually I much prefer either of these: if (test) { blah; } or if (test) blah; over the versions with '{ blah; }' (regardless of whether it's on the same line as 'if' or on the next line). It looks like the shorter versions are mostly used

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Brett Cannon
Here is a proposed update: diff -r 633f51d10a67 pep-0007.txt --- a/pep-0007.txt Mon Jan 18 10:52:57 2016 -0800 +++ b/pep-0007.txt Tue Jan 19 12:11:44 2016 -0800 @@ -75,9 +75,9 @@ } * Code structure: one space between keywords like ``if``, ``for`` and - the following left paren; no

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Martin Panter
On 19 January 2016 at 20:12, Brett Cannon wrote: > Here is a proposed update: > > diff -r 633f51d10a67 pep-0007.txt > --- a/pep-0007.txt Mon Jan 18 10:52:57 2016 -0800 > +++ b/pep-0007.txt Tue Jan 19 12:11:44 2016 -0800 > @@ -75,9 +75,9 @@ >} > > * Code structure: one

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread David Malcolm
On Mon, 2016-01-18 at 19:18 -0500, Terry Reedy wrote: > On 1/18/2016 6:20 PM, Brett Cannon wrote: > > > > > > On Sun, 17 Jan 2016 at 11:10 Brett Cannon > > wrote: > > > > While doing a review of http://bugs.python.org/review/26129/ I asked > >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Jim J. Jewett
> On Jan 17, 2016, at 11:10, Brett Cannon wrote: >> While doing a review of http://bugs.python.org/review/26129/ >> ... update PEP 7 to remove the optionality of curly braces On Mon Jan 18 03:39:42 EST 2016, Andrew Barnert pointed out: > There are two ways you could do that. [The one most

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Yury Selivanov
On 2016-01-18 6:20 PM, Brett Cannon wrote: On Sun, 17 Jan 2016 at 11:10 Brett Cannon > wrote: While doing a review of http://bugs.python.org/review/26129/ I asked to have curly braces put around all `if` statement bodies. Serhiy

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Brett Cannon
On Tue, 19 Jan 2016 at 00:48 M.-A. Lemburg wrote: > On 19.01.2016 00:20, Brett Cannon wrote: > > On Sun, 17 Jan 2016 at 11:10 Brett Cannon wrote: > > > >> While doing a review of http://bugs.python.org/review/26129/ I asked to > >> have curly braces put around

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-19 Thread Andrew Barnert via Python-Dev
> On Jan 19, 2016, at 08:56, Jim J. Jewett wrote: > > On Mon Jan 18 03:39:42 EST 2016, Andrew Barnert pointed out: >> >> Alternatively, it could say something like "braces must not be omitted; >> when other C styles would use a braceless one-liner, a one-liner with >>

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Barry Warsaw
On Jan 17, 2016, at 07:10 PM, Brett Cannon wrote: >Anyone object if I update PEP 7 to remove the optionality of curly braces >in PEP 7? +1 for requiring them everywhere, -1 for a wholesale reformatting of existing code. New code and significant refactoring/rewriting can adopt braces everywhere.

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Serhiy Storchaka
On 17.01.16 21:10, Brett Cannon wrote: While doing a review of http://bugs.python.org/review/26129/ I asked to have curly braces put around all `if` statement bodies. Serhiy pointed out that PEP 7 says curly braces are optional:

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread M.-A. Lemburg
On 18.01.2016 08:00, Victor Stinner wrote: > I like if without braces when the body is only one line, especially when > there is no else block. Same here. Compilers warn about these things today, so I don't think we need to go paranoid ;-) > Victor > > > Le dimanche 17 janvier 2016, Brett

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Andrew Barnert via Python-Dev
On Jan 17, 2016, at 11:10, Brett Cannon wrote: > > While doing a review of http://bugs.python.org/review/26129/ I asked to have > curly braces put around all `if` statement bodies. Serhiy pointed out that > PEP 7 says curly braces are optional: >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Nick Coghlan
On 18 January 2016 at 05:10, Brett Cannon wrote: > While doing a review of http://bugs.python.org/review/26129/ I asked to have > curly braces put around all `if` statement bodies. Serhiy pointed out that > PEP 7 says curly braces are optional: >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Larry Hastings
On 01/17/2016 11:10 AM, Brett Cannon wrote: Anyone object if I update PEP 7 to remove the optionality of curly braces in PEP 7? I'm -1. I don't like being forced to add the curly braces when the code is perfectly clear without them. If this was a frequent problem then I'd put up with it,

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Maciej Szulik
On Mon, Jan 18, 2016 at 9:59 AM, Larry Hastings wrote: > > > On 01/17/2016 11:10 AM, Brett Cannon wrote: > > Anyone object if I update PEP 7 to remove the optionality of curly braces > in PEP 7? > > > I'm -1. I don't like being forced to add the curly braces when the code >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Serhiy Storchaka
On 18.01.16 13:42, Maciej Szulik wrote: We'll be soon moving to github, which should simplify the process of submitting PRs from other developers interested in making our beautiful language even more awesome. I'm quite positive that with current review process that kind of bug should not happen,

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Chris Angelico
On Mon, Jan 18, 2016 at 10:42 PM, Maciej Szulik wrote: > On Mon, Jan 18, 2016 at 9:59 AM, Larry Hastings wrote: >> >> >> >> On 01/17/2016 11:10 AM, Brett Cannon wrote: >> >> Anyone object if I update PEP 7 to remove the optionality of curly braces >> in PEP

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Chris Angelico
On Mon, Jan 18, 2016 at 11:02 PM, Larry Hastings wrote: > On 01/18/2016 03:57 AM, Chris Angelico wrote: > > Rather than forcing people to use braces, wouldn't it be easier to > just add a linter to the toolchain that will detect those kinds of > problems and reject the commit?

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Stefan Krah
Brett Cannon python.org> writes: > Anyone object if I update PEP 7 to remove the optionality of curly braces in PEP 7? I strongly prefer braces everywhere, but I'm -1 on enforcing it. Stefan Krah ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Larry Hastings
On 01/18/2016 03:57 AM, Chris Angelico wrote: Rather than forcing people to use braces, wouldn't it be easier to just add a linter to the toolchain that will detect those kinds of problems and reject the commit? I don't understand your suggestion. If we automatically reject commits that

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Brett Cannon
On Mon, 18 Jan 2016 at 04:05 Serhiy Storchaka wrote: > On 18.01.16 13:42, Maciej Szulik wrote: > > We'll be soon moving to github, which should simplify the process of > > submitting PRs from other developers > > interested in making our beautiful language even more awesome.

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Yury Selivanov
I'm usually fine with code like this: if ( ... ) return But when there is a multi-line 'else' clause, I just want to use braces for both 'if' and its 'else'. So, for consistency, I'm +1 for recommending to use braces everywhere. And +1 for requiring to use braces if one of the

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Terry Reedy
On 1/18/2016 6:20 PM, Brett Cannon wrote: On Sun, 17 Jan 2016 at 11:10 Brett Cannon > wrote: While doing a review of http://bugs.python.org/review/26129/ I asked to have curly braces put around all `if` statement bodies. Serhiy pointed

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Brett Cannon
On Sun, 17 Jan 2016 at 11:10 Brett Cannon wrote: > While doing a review of http://bugs.python.org/review/26129/ I asked to > have curly braces put around all `if` statement bodies. Serhiy pointed out > that PEP 7 says curly braces are optional: >

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Brett Cannon
On Mon, 18 Jan 2016 at 00:59 Larry Hastings wrote: > > > On 01/17/2016 11:10 AM, Brett Cannon wrote: > > Anyone object if I update PEP 7 to remove the optionality of curly braces > in PEP 7? > > > I'm -1. I don't like being forced to add the curly braces when the code > is

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread MRAB
On 2016-01-19 00:18:08, "Terry Reedy" wrote: On 1/18/2016 6:20 PM, Brett Cannon wrote: On Sun, 17 Jan 2016 at 11:10 Brett Cannon > wrote: While doing a review of http://bugs.python.org/review/26129/ I asked to have curly

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Greg Ewing
Alexander Walters wrote: I am not a core developer, but I just kind of feel its hypocritical to oppose always using brackets for the development of *python* If we were being *really* pythonic, we would write all the C code without any braces at all, and feed it through a filter that adds them

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Alexander Walters
On 1/18/2016 23:27, Greg Ewing wrote: Brett Cannon wrote: For me, I don't see how:: if (x != 10) return NULL; do_some_more(); is any clearer or more readable than:: if (x != 10) { return NULL; } do_some_more(); Maybe not for that piece of code on its own, but the

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Greg Ewing
Alexander Walters wrote: When someone trying to make this argument in #python for Python code... the response is newlines are free. Well, I disagree. I very rarely put blank lines in a function in any language, because it makes it hard to scan the code visually and pick out the beginnings of

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Greg Ewing
Brett Cannon wrote: For me, I don't see how:: if (x != 10) return NULL; do_some_more(); is any clearer or more readable than:: if (x != 10) { return NULL; } do_some_more(); Maybe not for that piece of code on its own, but the version with braces takes up one more line. Put

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Nick Coghlan
On 19 January 2016 at 14:40, Alexander Walters wrote: > > > On 1/18/2016 23:27, Greg Ewing wrote: >> >> Brett Cannon wrote: >>> >>> For me, I don't see how:: >>> >>> if (x != 10) >>> return NULL; >>> do_some_more(); >>> >>> is any clearer or more readable than::

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Alexander Walters
On 1/19/2016 02:21, Larry Hastings wrote: On 01/18/2016 08:40 PM, Alexander Walters wrote: I am not a core developer, but I just kind of feel its hypocritical to oppose always using brackets for the development of *python* CPython isn't written in Python, it's written in C. So we use C

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Alexander Walters
On 1/19/2016 00:09, Greg Ewing wrote: Alexander Walters wrote: When someone trying to make this argument in #python for Python code... the response is newlines are free. Well, I disagree. I very rarely put blank lines in a function in any language, because it makes it hard to scan the code

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Glenn Linderman
On 1/18/2016 9:16 PM, Greg Ewing wrote: Alexander Walters wrote: I am not a core developer, but I just kind of feel its hypocritical to oppose always using brackets for the development of *python* If we were being *really* pythonic, we would write all the C code without any braces at all, and

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Alexander Walters
On 1/19/2016 01:04, Glenn Linderman wrote: On 1/18/2016 9:16 PM, Greg Ewing wrote: Alexander Walters wrote: I am not a core developer, but I just kind of feel its hypocritical to oppose always using brackets for the development of *python* If we were being *really* pythonic, we would write

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Peter Ludemann via Python-Dev
On 18 January 2016 at 23:25, Alexander Walters wrote: > > > On 1/19/2016 02:21, Larry Hastings wrote: > > > On 01/18/2016 08:40 PM, Alexander Walters wrote: > > I am not a core developer, but I just kind of feel its hypocritical to > oppose always using brackets for the

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Larry Hastings
On 01/18/2016 08:40 PM, Alexander Walters wrote: I am not a core developer, but I just kind of feel its hypocritical to oppose always using brackets for the development of *python* CPython isn't written in Python, it's written in C. So we use C idioms, which naturally are different from

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-18 Thread Georg Brandl
On 01/19/2016 01:18 AM, Terry Reedy wrote: > Though I don't write C anymore, I occasionally read our C sources. I > dislike mixed bracketing in a multiple clause if/else statement, and > would strongly recommend against that. On the other hand, to my > Python-trained eye, brackets for one

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-17 Thread Georg Brandl
On 01/17/2016 11:19 PM, Brett Cannon wrote: > > > On Sun, 17 Jan 2016, 13:59 Ethan Furman > wrote: > > On 01/17/2016 11:10 AM, Brett Cannon wrote: > > > https://www.imperialviolet.org/2014/02/22/applebug.html. Skipping the > > curly

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-17 Thread Victor Stinner
I like if without braces when the body is only one line, especially when there is no else block. Victor Le dimanche 17 janvier 2016, Brett Cannon a écrit : > While doing a review of http://bugs.python.org/review/26129/ I asked to > have curly braces put around all `if`

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-17 Thread Ethan Furman
On 01/17/2016 11:10 AM, Brett Cannon wrote: https://www.imperialviolet.org/2014/02/22/applebug.html. Skipping the curly braces is purely an aesthetic thing while leaving them out can lead to actual bugs. Not sure what that sentence actually says, but +1 on making them mandatory. -- ~Ethan~

[Python-Dev] Update PEP 7 to require curly braces in C

2016-01-17 Thread Brett Cannon
While doing a review of http://bugs.python.org/review/26129/ I asked to have curly braces put around all `if` statement bodies. Serhiy pointed out that PEP 7 says curly braces are optional: https://www.python.org/dev/peps/pep-0007/#id5. I would like to change that. My argument is to require them

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-17 Thread Brett Cannon
On Sun, 17 Jan 2016, 13:59 Ethan Furman wrote: > On 01/17/2016 11:10 AM, Brett Cannon wrote: > > > https://www.imperialviolet.org/2014/02/22/applebug.html. Skipping the > > curly braces is purely an aesthetic thing while leaving them out can > > lead to actual bugs. > > Not

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-17 Thread Robert Collins
+1 from me on requiring them. On 18 January 2016 at 11:19, Brett Cannon wrote: > > > On Sun, 17 Jan 2016, 13:59 Ethan Furman wrote: >> >> On 01/17/2016 11:10 AM, Brett Cannon wrote: >> >> > https://www.imperialviolet.org/2014/02/22/applebug.html. Skipping

Re: [Python-Dev] Update PEP 7 to require curly braces in C

2016-01-17 Thread Guido van Rossum
I'm +0. The editor I use is too smart to let me make this mistake, but I don't object to recommending it. As usual, though, let's not start mindless reformatting of existing code. -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list