[Python-Dev] conditional expressions - add parens?
Robert Brewer
fumanchu at amor.org
Wed Mar 8 02:04:30 CET 2006
Greg Ewing wrote:
> Jeremy Hylton wrote:
> > Perhaps the solution
> > is to require parens around all expressions, a simple
> consistent rule.
>
> I actually designed a language with that feature once.
> It was an exercise in minimality, with hardly anything
> built-in -- all the arithmetic operators, etc. were
> defined in the language.
>
> A result was that there was no built-in notion of
> precedence, and my solution was to require parentheses
> around every infix operation. So instead of
>
> dsq = b * b - 4 * a * c
>
> you would have had to write
>
> dsq = ((b * b) - ((4 * a) * c))
>
> I never got an implementation working well enough
> to find out how much of a disaster this would
> have been to use, though. :-)
I already do that anyway, and even update other people's code in any
open-source projects I contribute to, because I find it *far* easier to
read and write 'unnecessary' parens than remember precedence rules. But
I can understand why some people would balk at it, so +0.5 from me. ;)
Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org
More information about the Python-Dev
mailing list