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] _PyThreadState_Current

2016-01-18 Thread Maciej Fijalkowski
seems to work thanks. That said, I would love to have PyThreadState_Get equivalent that would let me handle the NULL. On Mon, Jan 18, 2016 at 9:31 PM, Maciej Fijalkowski wrote: > Good point > > On Mon, Jan 18, 2016 at 9:25 PM, Victor Stinner > wrote:

Re: [Python-Dev] PEP 509: Add a private version to dict

2016-01-18 Thread Victor Stinner
Is someone opposed to this PEP 509? The main complain was the change on the public Python API, but the PEP doesn't change the Python API anymore. I'm not aware of any remaining issue on this PEP. Victor 2016-01-11 17:49 GMT+01:00 Victor Stinner : > Hi, > > After a

Re: [Python-Dev] _PyThreadState_Current

2016-01-18 Thread Maciej Fijalkowski
Good point On Mon, Jan 18, 2016 at 9:25 PM, Victor Stinner wrote: > Hum, you can try to lie and define Py_BUILD_CORE? > > Victor > > 2016-01-18 21:18 GMT+01:00 Maciej Fijalkowski : >> Hi >> >> change in between 3.5.0 and 3.5.1 (hiding

Re: [Python-Dev] PEP 509: Add a private version to dict

2016-01-18 Thread Barry Warsaw
On Jan 18, 2016, at 11:43 PM, Victor Stinner wrote: >Is someone opposed to this PEP 509? > >The main complain was the change on the public Python API, but the PEP >doesn't change the Python API anymore. > >I'm not aware of any remaining issue on this PEP. Have you done any performance analysis