Re: [Python-Dev] PEP 7: Adding anonymous union / struct

2019-04-17 Thread Inada Naoki
On Wed, Apr 17, 2019 at 8:27 PM Victor Stinner wrote: > > AIX is somehow supported and uses xlc compiler: does xlc support this > C11 feature? I find Language Reference for v11.1 (2010/4/13) https://www-01.ibm.com/support/docview.wss?uid=swg27017991 I find "anonymous union" in p73. I can not fi

Re: [Python-Dev] PEP 7: Adding anonymous union / struct

2019-04-17 Thread Victor Stinner
AIX is somehow supported and uses xlc compiler: does xlc support this C11 feature? Do you want to use it in Python 3.8 and newer only? Victor Le mer. 17 avr. 2019 à 13:14, Inada Naoki a écrit : > > Hi, all. > > PEP 7 includes some C99 features. > I propose to add include anonymous union and str

[Python-Dev] PEP 7: Adding anonymous union / struct

2019-04-17 Thread Inada Naoki
Hi, all. PEP 7 includes some C99 features. I propose to add include anonymous union and struct to the list. https://www.geeksforgeeks.org/g-fact-38-anonymous-union-and-structure/ Anonymous union and struct are C11 feature, not C99. But gcc and MSVC supported it as language extension from before C

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-06 Thread Ethan Furman
On 06/06/2017 05:30 PM, Barry Warsaw wrote: On Jun 05, 2017, at 08:19 AM, Ethan Furman wrote: I would format that as: if (PyErr_WarnFormat( PyExc_DeprecationWarning, 1, "invalid escape sequence '\\%c'", *first_i

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-06 Thread Rob Cliffe
On 07/06/2017 01:30, Barry Warsaw wrote: On Jun 05, 2017, at 08:41 AM, Serhiy Storchaka wrote: the example above), and the following code is enough readable: if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "invalid escape sequence '\\%c'",

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-06 Thread Barry Warsaw
On Jun 05, 2017, at 07:00 AM, Skip Montanaro wrote: >Wow, this discussion takes me back. Glad I don't have to check out >comp.lang.c to get my brace placement fix. Life is better without braces! -Barry ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-06 Thread Barry Warsaw
On Jun 05, 2017, at 08:41 AM, Serhiy Storchaka wrote: >the example above), and the following code is enough readable: > > if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, > "invalid escape sequence '\\%c'", > *first_invalid_escape)

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-05 Thread MRAB
On 2017-06-05 13:00, Skip Montanaro wrote: On Mon, Jun 5, 2017 at 12:41 AM, Serhiy Storchaka wrote: Barry and Victor prefer moving a brace on a new line in all multiline conditional cases. I think that it should be done only when the condition continuation lines and the following block of the c

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-05 Thread Ethan Furman
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "invalid escape sequence '\\%c'", *first_invalid_escape) < 0) { Py_DECREF(result); return NULL; } What other core developers think about this?

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-05 Thread Skip Montanaro
On Mon, Jun 5, 2017 at 12:41 AM, Serhiy Storchaka wrote: > Barry and Victor prefer moving a brace on a new line in all multiline > conditional cases. I think that it should be done only when the condition > continuation lines and the following block of the code have the same > indentation (as in t

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-05 Thread Stefan Behnel
Serhiy Storchaka schrieb am 03.06.2017 um 18:25: > Yet about braces. PEP 7 implicitly forbids breaking the line before an > opening brace. An opening brace should stay at the end the line of the > outer compound statement. > > if (mro != NULL) { > ... > } > else { > ...

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-04 Thread Serhiy Storchaka
03.06.17 23:30, Barry Warsaw пише: On Jun 03, 2017, at 07:25 PM, Serhiy Storchaka wrote: But the latter example continuation lines are intended at the same level as the following block of code. I propose to make exception for that case and allow moving an open brace to the start of the next lin

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-03 Thread Barry Warsaw
On Jun 03, 2017, at 07:25 PM, Serhiy Storchaka wrote: >But the latter example continuation lines are intended at the same level as >the following block of code. I propose to make exception for that case and >allow moving an open brace to the start of the next line. > > if (type->tp_dictoffset

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-03 Thread Serhiy Storchaka
Yet about braces. PEP 7 implicitly forbids breaking the line before an opening brace. An opening brace should stay at the end the line of the outer compound statement. if (mro != NULL) { ... } else { ... } if (type->tp_dictoffset != 0 && base->tp_dictoffset

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-01 Thread Barry Warsaw
https://github.com/python/peps/pull/280/files On Jun 01, 2017, at 09:08 PM, Brett Cannon wrote: >If you create an issue at github.com/python/peps and assign it to me I will >get to it someday. :) pgpqhM6HQldC5.pgp Description: OpenPGP digital signature __

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-01 Thread Brett Cannon
If you create an issue at github.com/python/peps and assign it to me I will get to it someday. :) On Thu, 1 Jun 2017 at 00:19 Victor Stinner wrote: > 2017-05-31 19:27 GMT+02:00 Guido van Rossum : > > I interpret the PEP (...) > > Right, the phrasing requires to "interpret" it :-) > > > (...) as

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-01 Thread Victor Stinner
2017-05-31 19:27 GMT+02:00 Guido van Rossum : > I interpret the PEP (...) Right, the phrasing requires to "interpret" it :-) > (...) as saying that you should use braces everywhere but not > to add them in code that you're not modifying otherwise. (I.e. don't go on a > brace-adding rampage.) If a

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Serhiy Storchaka
01.06.17 09:36, Benjamin Peterson пише: Modern GCC can defend against these kinds of problems. If I introduce a "goto fail" bug somewhere in Python, I get a nice warning: ../Objects/abstract.c: In function ‘PyObject_Type’: ../Objects/abstract.c:35:5: warning: this ‘if’ clause does not guard... [-

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Serhiy Storchaka
31.05.17 20:27, Guido van Rossum пише: I interpret the PEP as saying that you should use braces everywhere but not to add them in code that you're not modifying otherwise. (I.e. don't go on a brace-adding rampage.) If author and reviewer of a PR disagree I would go with "add braces" since that'

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Benjamin Peterson
Modern GCC can defend against these kinds of problems. If I introduce a "goto fail" bug somewhere in Python, I get a nice warning: ../Objects/abstract.c: In function ‘PyObject_Type’: ../Objects/abstract.c:35:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (o == NUL

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Greg Ewing
Seems like a good idea to tighten it up. If a style guide is going to say "you can either do X or not do X", it might as well not mention X at all. :-) -- Greg ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/p

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Guido van Rossum
I interpret the PEP as saying that you should use braces everywhere but not to add them in code that you're not modifying otherwise. (I.e. don't go on a brace-adding rampage.) If author and reviewer of a PR disagree I would go with "add braces" since that's clearly the PEP's preference. This is C c

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Serhiy Storchaka
31.05.17 17:11, Victor Stinner пише: I have a question on the CPython coding code for C code, the PEP 7: https://www.python.org/dev/peps/pep-0007/ """ Code structure: (...); braces are strongly preferred but may be omitted where C permits, and they should be formatted as shown: if (mro != NULL)

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Oren Milman
the 'goto fail' bug is a somewhat extreme reminder for why such braces are a good idea (as Victor said) - https://www.imperialviolet.org/2014/02/22/applebug.html On Wed, May 31, 2017 at 6:25 PM Paul Moore wrote: > On 31 May 2017 at 15:11, Victor Stinner wrote: > > So I would suggest to modify t

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Paul Moore
On 31 May 2017 at 15:11, Victor Stinner wrote: > So I would suggest to modify the PEP 7 to *always* require braces for if. > > I would also suggest to require braces on "for(...) { ... }" and > "while(...) { ... }". But only if the code has to be modified, not > only to update the coding style. >

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Barry Warsaw
On May 31, 2017, at 04:13 PM, Victor Stinner wrote: >Previous discussion which added "strongly preferred" to the PEP 7, January >2016: https://mail.python.org/pipermail/python-dev/2016-January/142746.html I had to go back to make sure I wouldn't contradict myself. +1 then, +1 now for requiring b

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Victor Stinner
Previous discussion which added "strongly preferred" to the PEP 7, January 2016: https://mail.python.org/pipermail/python-dev/2016-January/142746.html Victor 2017-05-31 16:11 GMT+02:00 Victor Stinner : > Hi, > > I have a question on the CPython coding code for C code, the PEP 7: > https://www.pyt

[Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Victor Stinner
Hi, I have a question on the CPython coding code for C code, the PEP 7: https://www.python.org/dev/peps/pep-0007/ """ Code structure: (...); braces are strongly preferred but may be omitted where C permits, and they should be formatted as shown: if (mro != NULL) { ... } else { ... } """

Re: [Python-Dev] PEP 7 contradiction for comment style

2017-01-11 Thread Brett Cannon
https://github.com/python/peps/issues/176 is tracking the need to update the PEP. On Tue, 10 Jan 2017 at 23:45 Benjamin Peterson wrote: > Your assumption is correct. Perhaps the PEP 7 should be partitioned into > "< 3.6" and "3.6" sections where applicable. > > On Mon, Jan 9, 2017, at 12:50, Bre

Re: [Python-Dev] PEP 7 contradiction for comment style

2017-01-10 Thread Benjamin Peterson
Your assumption is correct. Perhaps the PEP 7 should be partitioned into "< 3.6" and "3.6" sections where applicable. On Mon, Jan 9, 2017, at 12:50, Brett Cannon wrote: > https://bugs.python.org/issue29215 noticed that PEP 7 says "C++-style > line > comments" are allowed, but then later says "Neve

[Python-Dev] PEP 7 contradiction for comment style

2017-01-10 Thread Brett Cannon
https://bugs.python.org/issue29215 noticed that PEP 7 says "C++-style line comments" are allowed, but then later says "Never use C++ style // one-line comments." I'm assuming we are sticking with allowing C++-style comments and the "never" link just needs an addendum to say that only applies to cod

Re: [Python-Dev] pep 7

2015-03-20 Thread Brian Curtin
On Fri, Mar 20, 2015 at 10:57 PM, Guido van Rossum wrote: > Neil, you have no idea. Please back off. I wouldn't go that far. Wanting a quality code base certainly isn't a bad thing, but there's a lot more progress to be made by working with what's there and being as mindful as possible of the gui

Re: [Python-Dev] pep 7

2015-03-20 Thread Guido van Rossum
Neil, you have no idea. Please back off. On Fri, Mar 20, 2015 at 8:02 PM, Neil Girdhar wrote: > The code reviews I got asked me to revert PEP 7 changes. I can understand > that, but then logically someone should go ahead and clean up the code. > It's not "high risk" if you just check for whites

Re: [Python-Dev] pep 7

2015-03-20 Thread Brian Curtin
On Fri, Mar 20, 2015 at 10:02 PM, Neil Girdhar wrote: > The code reviews I got asked me to revert PEP 7 changes. I can understand > that, but then logically someone should go ahead and clean up the code. > It's not "high risk" if you just check for whitespace equivalence of the > source code and

Re: [Python-Dev] pep 7

2015-03-20 Thread Neil Girdhar
The code reviews I got asked me to revert PEP 7 changes. I can understand that, but then logically someone should go ahead and clean up the code. It's not "high risk" if you just check for whitespace equivalence of the source code and binary equivalence of the compiled code. The value is for peop

Re: [Python-Dev] pep 7

2015-03-20 Thread Brian Curtin
On Fri, Mar 20, 2015 at 7:54 PM, Neil Girdhar wrote: > If ever someone wants to clean up the repository to conform to PEP 7, I > wrote a program that catches a couple hundred PEP 7 violations in ./Python > alone (1400 in the whole codebase): > > import os > import re > > def grep(path, regex): >

[Python-Dev] pep 7

2015-03-20 Thread Neil Girdhar
If ever someone wants to clean up the repository to conform to PEP 7, I wrote a program that catches a couple hundred PEP 7 violations in ./Python alone (1400 in the whole codebase): import os import re def grep(path, regex): reg_obj = re.compile(regex, re.M) res = [] for root, dirs,

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-04 Thread Brian Curtin
On Wed, Jan 4, 2012 at 00:30, Stephen J. Turnbull wrote: > Benjamin Peterson writes: > >  > My goodness, I was trying to make a ridiculous-sounding proposition. > > In this kind of discussion, that's in the same class as "be careful > what you wish for -- because you might just get it." I wish we

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Stephen J. Turnbull
Benjamin Peterson writes: > My goodness, I was trying to make a ridiculous-sounding proposition. In this kind of discussion, that's in the same class as "be careful what you wish for -- because you might just get it." ___ Python-Dev mailing list Python

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Benjamin Peterson
2012/1/3 Stephen J. Turnbull : > Benjamin Peterson writes: >  > Ethan Furman stoneleaf.us> writes: >  > > >  > > Readability also includes more than just the source code; as has already >  > > been stated: > > [diffs elided] > >  > > I find the diff version that already had braces in place much mo

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Stephen J. Turnbull
Benjamin Peterson writes: > Ethan Furman stoneleaf.us> writes: > > > > Readability also includes more than just the source code; as has already > > been stated: [diffs elided] > > I find the diff version that already had braces in place much more > > readable. > > There are much larg

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Benjamin Peterson
Ethan Furman stoneleaf.us> writes: > > Readability also includes more than just the source code; as has already > been stated: > > if(cond) { > stmt1; > + stmt2; > } > > vs. > > -if(cond) > +if(cond) { > stmt1; > + stmt2; > +} > > I find the diff version that already had braces

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Martin v. Löwis
> Readability also includes more than just the source code; as has already > been stated: > > if(cond) { >stmt1; > + stmt2; > } > > vs. > > -if(cond) > +if(cond) { >stmt1; > + stmt2; > +} > > I find the diff version that already had braces in place much more > readable. Is it reall

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Ben Finney
"Stephen J. Turnbull" writes: > Matt Joiner writes: > > > Readability is the highest concern, and this should be at the > > discretion of the contributor. > > That's quite backwards. "Readability" is community property, and has > as much, if not more, to do with common convention as with some

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Ethan Furman
Stephen J. Turnbull wrote: Matt Joiner writes: > Readability is the highest concern, and this should be at the > discretion of the contributor. That's quite backwards. "Readability" is community property, and has as much, if not more, to do with common convention as with some absolute metric

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Stephen J. Turnbull
Matt Joiner writes: > Readability is the highest concern, and this should be at the > discretion of the contributor. That's quite backwards. "Readability" is community property, and has as much, if not more, to do with common convention as with some absolute metric. The "contributor's discret

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Matt Joiner
FWIW I'm against forcing braces to be used. Readability is the highest concern, and this should be at the discretion of the contributor. A code formatting tool, or compiler extension is the only proper handle this, and neither are in use or available. On Tue, Jan 3, 2012 at 7:44 PM, "Martin v. Löw

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-03 Thread Martin v. Löwis
> He keeps leaving them out, I occasionally tell him they should always > be included (most recently this came up when we gave conflicting > advice to a patch contributor). He says what he's doing is OK, because > he doesn't consider the example in PEP 7 as explicitly disallowing it, > I think it's

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Barry Warsaw
On Jan 02, 2012, at 02:08 PM, Guido van Rossum wrote: >The irony is that style guides exist to *avoid* debates like this. Yes, the >choices are arbitrary. Yes, tastes differ. Yes, there are exceptions to the >rules. But still, once a style rule has been set, the idea is to stop >debating and just

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Guido van Rossum
On Mon, Jan 2, 2012 at 4:27 PM, Nick Coghlan wrote: > On Tue, Jan 3, 2012 at 8:32 AM, Raymond Hettinger > wrote: > > Running ``grep -B1 else Objects/*c`` shows that we've happily lived > with a > > mixture of styles for a very long time. > > ISTM, our committers have had good instincts about wh

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Tim Delaney
On 3 January 2012 09:55, Raymond Hettinger wrote: > > On Jan 2, 2012, at 2:09 PM, Tim Delaney wrote: > > I'd also point out that if you're expecting braces, not having them can > make the code less readable. > > > If a programmer's mind explodes when they look at the simple and beautiful > example

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Raymond Hettinger
On Jan 2, 2012, at 4:27 PM, Nick Coghlan wrote: > With my perception of the status quo corrected, I can stop worrying > about preserving a non-existent consistency. +1 QOTD Raymond ___ Python-Dev mailing list Python-Dev@python.org http://mail.python

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Nick Coghlan
On Tue, Jan 3, 2012 at 8:32 AM, Raymond Hettinger wrote: > Running  ``grep -B1 else Objects/*c`` shows that we've happily lived with a > mixture of styles for a very long time. > ISTM, our committers have had good instincts about when braces add clarity > and when they add clutter. > If Nick pushe

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Nick Coghlan
On Tue, Jan 3, 2012 at 12:54 AM, Benjamin Peterson wrote: > I think it's fine Nick raised this. PEP 7 is not very explicit about > braces at all. I actually discovered in this thread that I've been misreading PEP 7 for going on 7 years now - I thought the brace usage example *did* use "} else {"

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Ned Batchelder
On 1/2/2012 5:32 PM, Raymond Hettinger wrote: Running ``grep -B1 else Objects/*c`` shows that we've happily lived with a mixture of styles for a very long time. ISTM, our committers have had good instincts about when braces add clarity and when they add clutter. If Nick pushes through an alwa

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Raymond Hettinger
On Jan 2, 2012, at 2:09 PM, Tim Delaney wrote: > I'd also point out that if you're expecting braces, not having them can make > the code less readable. If a programmer's mind explodes when they look at the simple and beautiful examples in K&R's The C Programming Language, then they've got pro

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Raymond Hettinger
On Jan 2, 2012, at 12:31 PM, Benjamin Peterson wrote: > I might add that assuming you have braces, PEP 7 would want you to format it > as > > if (cond) { >statement; > } > else { >more_stuff; > } > Running ``grep -B1 else Objects/*c`` shows that we've happily lived with a mixture o

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Tim Delaney
On 3 January 2012 08:50, Larry Hastings wrote: > On 01/02/2012 12:47 AM, Raymond Hettinger wrote: > >> Really? Do we need to have a brace war? >> People have different preferences. >> The standard library includes some of both styles >> depending on what the maintainer thought was cleanest to th

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Guido van Rossum
On Mon, Jan 2, 2012 at 1:50 PM, Larry Hastings wrote: > On 01/02/2012 12:47 AM, Raymond Hettinger wrote: > >> Really? Do we need to have a brace war? >> People have different preferences. >> The standard library includes some of both styles >> depending on what the maintainer thought was cleanes

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Larry Hastings
On 01/02/2012 12:47 AM, Raymond Hettinger wrote: Really? Do we need to have a brace war? People have different preferences. The standard library includes some of both styles depending on what the maintainer thought was cleanest to their eyes in a given context. I'm with Raymond. Code should

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Benjamin Peterson
2012/1/1 Nick Coghlan : > >  if (cond) { >    statement; >  } else { >    statement; >  } I might add that assuming you have braces, PEP 7 would want you to format it as if (cond) { statement; } else { more_stuff; } -- Regards, Benjamin ___ P

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/02/2012 01:02 AM, Nick Coghlan wrote: > On Mon, Jan 2, 2012 at 3:04 PM, Scott Dial > wrote: >> On 1/1/2012 11:44 PM, Nick Coghlan wrote: >>> I think it's a recipe for future maintenance hassles when someone >>> adds a second statement to one of

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Benjamin Peterson
2012/1/1 Nick Coghlan : > I've been having an occasional argument with Benjamin regarding braces > in 4-line if statements: Python's C code has been dropping braces long before I ever arrived. See this beautiful example in dictobject.c, for example: if (numfree < PyDict_MAXFREELIST && Py_TYPE

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Ned Batchelder
On 1/1/2012 11:44 PM, Nick Coghlan wrote: I've been having an occasional argument with Benjamin regarding braces in 4-line if statements: if (cond) statement; else statement; vs. if (cond) { statement; } else { statement; } He keeps leaving them out, I occas

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Petri Lehtinen
Antoine Pitrou wrote: > I don't like having the else on the same line as the closing brace, > and prefer: > >if (cond) { >statement; >} >else { >statement; >} And this is how it's written in PEP-7. It seems to me that PEP-7 doesn't require braces. But it explicitly

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Antoine Pitrou
On Mon, 2 Jan 2012 14:44:49 +1000 Nick Coghlan wrote: > I've been having an occasional argument with Benjamin regarding braces > in 4-line if statements: > > if (cond) > statement; > else > statement; > > vs. > > if (cond) { > statement; > } else { > statement; > } Go

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Nick Coghlan
On Mon, Jan 2, 2012 at 6:47 PM, Raymond Hettinger wrote: > Really?  Do we need to have a brace war? > People have different preferences. > The standard library includes some of both styles > depending on what the maintainer thought was cleanest to their eyes in a > given context. If the answer i

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Raymond Hettinger
On Jan 1, 2012, at 8:44 PM, Nick Coghlan wrote: > I've been having an occasional argument with Benjamin regarding braces > in 4-line if statements: > > if (cond) >statement; > else >statement; > > vs. > > if (cond) { >statement; > } else { >statement; > } Really? Do we

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-02 Thread Nick Coghlan
On Mon, Jan 2, 2012 at 4:22 PM, Ron Adam wrote: > The problem is only when an additional statement is added to the last > block, not the preceding ones, as the compiler will complain about > those.  So I don't know how the 4 line example without braces is any > worse than a 2 line if without brace

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-01 Thread Ron Adam
On Mon, 2012-01-02 at 14:44 +1000, Nick Coghlan wrote: > I've been having an occasional argument with Benjamin regarding braces > in 4-line if statements: > > if (cond) > statement; > else > statement; > > vs. > > if (cond) { > statement; > } else { > statement; > } >

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-01 Thread Nick Coghlan
On Mon, Jan 2, 2012 at 3:04 PM, Scott Dial wrote: > On 1/1/2012 11:44 PM, Nick Coghlan wrote: >> I think it's a recipe for future maintenance hassles when someone adds >> a second statement to one of the clauses but doesn't add the braces. >> (The only time I consider it reasonable to leave out th

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-01 Thread Scott Dial
On 1/1/2012 11:44 PM, Nick Coghlan wrote: > I think it's a recipe for future maintenance hassles when someone adds > a second statement to one of the clauses but doesn't add the braces. > (The only time I consider it reasonable to leave out the braces is for > one liner if statements, where there's

Re: [Python-Dev] PEP 7 clarification request: braces

2012-01-01 Thread Ben Finney
Nick Coghlan writes: > He keeps leaving [braces] out [when the block is a single statement], > I occasionally tell him they should always be included (most recently > this came up when we gave conflicting advice to a patch contributor). As someone who has maintained his fair share of C code, I a

[Python-Dev] PEP 7 clarification request: braces

2012-01-01 Thread Nick Coghlan
I've been having an occasional argument with Benjamin regarding braces in 4-line if statements: if (cond) statement; else statement; vs. if (cond) { statement; } else { statement; } He keeps leaving them out, I occasionally tell him they should always be included (most

Re: [Python-Dev] PEP 7 updated

2010-05-13 Thread Brett Cannon
Feel free to look at Misc/Vim/python.vim and see if this works better than what is already there. On Wed, May 12, 2010 at 20:47, Trent Nelson wrote: > >> Does anyone know of a way to teach vim that C sources in a python checkout >> should have 4-space indents without changing the defaults for oth

Re: [Python-Dev] PEP 7 updated

2010-05-12 Thread Trent Nelson
Does anyone know of a way to teach vim that C sources in a python checkout should have 4-space indents without changing the defaults for other C files? I use this in my vimrc: "" " indentation: use detectindent plugi

Re: [Python-Dev] PEP 7 updated

2010-05-11 Thread Antoine Pitrou
Le mardi 11 mai 2010 à 16:44 -0700, Sridhar Ratnakumar a écrit : > Nor did it break any of our ActivePython 2.7 (Python trunk) builds ... > though I had to hand-edit the patches to use 4 spaces now. Will this > untabification change be made to the `release2.6-maint` branch too? It has already been

Re: [Python-Dev] PEP 7 updated

2010-05-11 Thread Sridhar Ratnakumar
Nor did it break any of our ActivePython 2.7 (Python trunk) builds ... though I had to hand-edit the patches to use 4 spaces now. Will this untabification change be made to the `release2.6-maint` branch too? -srid On 2010-05-09, at 11:33 AM, Antoine Pitrou wrote: > > Hello, > > The untabific

Re: [Python-Dev] PEP 7 updated

2010-05-10 Thread David Borowitz
On Mon, May 10, 2010 at 07:09, Ronald Oussoren wrote: > > On 9 May, 2010, at 20:33, Antoine Pitrou wrote: > > > > > Hello, > > > > The untabification of C files didn't produce any noticeable problem on > > the buildbots. I've updated PEP 7 with the mention that all C files > > should be 4-space i

Re: [Python-Dev] PEP 7 updated

2010-05-10 Thread Ronald Oussoren
On 9 May, 2010, at 20:33, Antoine Pitrou wrote: > > Hello, > > The untabification of C files didn't produce any noticeable problem on > the buildbots. I've updated PEP 7 with the mention that all C files > should be 4-space indented, and removed the obsolete wording about > some files being in

[Python-Dev] PEP 7 updated

2010-05-09 Thread Antoine Pitrou
Hello, The untabification of C files didn't produce any noticeable problem on the buildbots. I've updated PEP 7 with the mention that all C files should be 4-space indented, and removed the obsolete wording about some files being indented with tabs. Regards Antoine. _