Re: Operator Precedence: One Thing Python Got Right

2016-06-27 Thread Lawrence D’Oliveiro
On Tuesday, June 28, 2016 at 2:32:48 AM UTC+12, Grant Edwards wrote: > > On 2016-06-27, BartC wrote: > >> I bet your code isn't very 'Pythonic' then! > > No, not when the end goal is to move it into C. I wonder: how much real-world C code would be broken if the operator precedences in C were cha

Re: Operator Precedence: One Thing Python Got Right

2016-06-27 Thread Grant Edwards
On 2016-06-27, BartC wrote: > On 27/06/2016 15:04, Grant Edwards wrote: >> On 2016-06-27, Steven D'Aprano wrote: >> >>> Do you write much Python code that you expect to also be valid C code? >> >> Depends on what you mean by "much", but yes, it's certainly >> something I do. I often develop and

Re: Operator Precedence: One Thing Python Got Right

2016-06-27 Thread BartC
On 27/06/2016 15:04, Grant Edwards wrote: On 2016-06-27, Steven D'Aprano wrote: Do you write much Python code that you expect to also be valid C code? Depends on what you mean by "much", but yes, it's certainly something I do. I often develop and test algorithms in Python and then cut/paste

Re: Operator Precedence: One Thing Python Got Right

2016-06-27 Thread Grant Edwards
On 2016-06-27, Steven D'Aprano wrote: > Do you write much Python code that you expect to also be valid C code? Depends on what you mean by "much", but yes, it's certainly something I do. I often develop and test algorithms in Python and then cut/paste much of the Python code into C programs. T

Re: Operator Precedence: One Thing Python Got Right

2016-06-27 Thread Steven D'Aprano
On Mon, 27 Jun 2016 07:53 pm, BartC wrote: > On 27/06/2016 05:20, Lawrence D’Oliveiro wrote: >> How did I discover this? Entirely by accident: I forgot the parentheses >> one day and *didn’t* hit a bug. :) > > That's not wise. It could have worked by chance. And putting in the > parentheses anyw

Re: Operator Precedence: One Thing Python Got Right

2016-06-27 Thread BartC
On 27/06/2016 05:20, Lawrence D’Oliveiro wrote: There is one thing Python did not slavishly copy from C. While it has (mostly) the same operators, and exclusively adopted the iso646 names for the Boolean operators (which you can also use in C and C++, by the way, but not Java), it made a slight

Re: Operator Precedence: One Thing Python Got Right

2016-06-26 Thread Steven D'Aprano
On Mon, 27 Jun 2016 02:20 pm, Lawrence D’Oliveiro wrote: > There is one thing Python did not slavishly copy from C. Only one? -- Steven “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-lis

Operator Precedence: One Thing Python Got Right

2016-06-26 Thread Lawrence D’Oliveiro
There is one thing Python did not slavishly copy from C. While it has (mostly) the same operators, and exclusively adopted the iso646 names for the Boolean operators (which you can also use in C and C++, by the way, but not Java), it made a slight tweak to the operator precedence rules