Operator precedence problem
Grant Edwards
grant.b.edwards at gmail.com
Mon Jun 6 12:51:52 EDT 2016
More information about the Python-list mailing list
Mon Jun 6 12:51:52 EDT 2016
- Previous message (by thread): Operator precedence problem
- Next message (by thread): Operator precedence problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2016-06-06, Chris Angelico <rosuav at gmail.com> wrote: > On Tue, Jun 7, 2016 at 1:27 AM, Jon Ribbens ><jon+usenet at unequivocal.co.uk> wrote: >>>> You should put brackets around expressions when it's at all >>>> unclear what the meaning is. You could think of them a bit like >>>> "active comments" I suppose. >>> >>> Your code should keep noise to the minimum. >> >> Sensible and beneficial comments aren't "noise". > > In that case, please never insult the intelligence of your future > readers by including any of these parentheses: > > x = 1 + (2 * 3) > value = 77 if (x % 2) else (70*7) Just for the record, I don't have any problem at all with any of those parens. I don't think they're at all insulting, they don't slow down comprehension, and they make clear the intent of the writer. I'm not sure I would include all of them if _I_ were writing the code, but in this specific example, I think they're fine. That said, I have seen lots of cases where fully parenthising an expression would harm readability... -- Grant Edwards grant.b.edwards Yow! My nose feels like a at bad Ronald Reagan movie ... gmail.com
- Previous message (by thread): Operator precedence problem
- Next message (by thread): Operator precedence problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list