Re: [Python-Dev] Code formatter bot

2016-01-19 Thread Gregory P. Smith
Indeed, automated code formatting is a good thing. But a bot is the wrong approach. You want a code formatting checker as a potential pre-submit hook (like we have had for white space issues in the past), but until you have super high confidence in it you need to make sure it is not a blocker for a

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 space between keywor

Re: [Python-Dev] Code formatter bot

2016-01-19 Thread Senthil Kumaran
On Tue, Jan 19, 2016 at 12:59 PM, francismb wrote: > Pros, Cons, where could be applicable (new commits, new workflow, it > doesn't make sense), ... > -1. formatting should be done by humans (with the help of tools) before committing. It should not be left to a robot to make automatic changes.

Re: [Python-Dev] Code formatter bot

2016-01-19 Thread Sven R. Kunze
Not a core dev, but I would definitely recommend using them. Best, Sven On 19.01.2016 21:59, francismb wrote: Dear Core-Devs, what's your opinion about a code-formatter bot for cpython. Pros, Cons, where could be applicable (new commits, new workflow, it doesn't make sense), ... - At least it

[Python-Dev] Code formatter bot

2016-01-19 Thread francismb
Dear Core-Devs, what's your opinion about a code-formatter bot for cpython. Pros, Cons, where could be applicable (new commits, new workflow, it doesn't make sense), ... - At least it should follow PEP 7 ;-) - ... Thanks in advance, francis ___ Pytho

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: > https://www.python.org/dev/peps/pep-0007/#id5.

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 wr

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 says curly braces are

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 spaces

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 in

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 singl

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 >> braces should be used inste

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 all `if` statement bodies. Serhiy p

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 p

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 pointed out that PEP 7 sa

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 > > to have curly braces

Re: [Python-Dev] Reference cycle on the module dict (globals())

2016-01-19 Thread Victor Stinner
Hi, 2016-01-19 11:39 GMT+01:00 Petr Viktorin : >> Did I miss something obvious, or is it a known issue of the garbage >> collector on modules? > > The default type flags are for objects that don't store references. > Since you're creating a mutable container, you need to set > Py_TPFLAGS_HAVE_GC.

Re: [Python-Dev] _PyThreadState_Current

2016-01-19 Thread Victor Stinner
Since it's a regression introduced in Python 3.5.1, I propose to introduce a new private function _PyThreadState_FastGet() to reintroduce the feature: https://bugs.python.org/issue26154 Using afunction instead of using directly the variable hides how atomic variables are implemented and so avoid c

Re: [Python-Dev] Reference cycle on the module dict (globals())

2016-01-19 Thread Petr Viktorin
On 01/19/2016 10:42 AM, Victor Stinner wrote: > Hi, > > While working on my FAT Python optimizer project, I found an annoying > bug in my code. When at least one guard is created with a reference to > the global namespace (globals(), the module dictionary), objects of > the module are no more remo

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

[Python-Dev] Reference cycle on the module dict (globals())

2016-01-19 Thread Victor Stinner
Hi, While working on my FAT Python optimizer project, I found an annoying bug in my code. When at least one guard is created with a reference to the global namespace (globals(), the module dictionary), objects of the module are no more removed at exit. Example: --- import sys class MessageAtExit

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 looki

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 are optional: >> h

Re: [Python-Dev] PEP 510: Specialize functions with guards

2016-01-19 Thread Victor Stinner
Oh, I think that the PEP 510 lacks two functions to: * remove a specific specialized code * remove all specialized code Victor ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://ma