allow line break at operators

Chris Angelico rosuav at gmail.com
Mon Aug 15 10:16:55 EDT 2011


On Mon, Aug 15, 2011 at 2:41 PM, Roy Smith <roy at panix.com> wrote:
> Demand, no, but sometimes it's a good idea.  I've been writing computer
> programs for close to 40 years, and I still have no clue what most of
> the order of operations is.  It's just not worth investing the brain
> cells to remember such trivia (especially since the details change from
> language to language).  Beyond remembering the (apparently) universal
> rule that {*, /} bind tighter than {+, -}, I pretty much just punt on
> everything else and put in extra parens everywhere.
>

Understandable. I go the other way, though, and keep an operator
precedence table for each language handy; often, what I'm after is not
"which one binds more tightly", but "what's the symbol for modulo",
which is also (usually) on that same table. Or: "Blasted PHP, which
operators have precedence between || and or?" which is easy to forget.

And you're right about the details changing from language to language,
hence the operators table *for each language*. But most languages
follow fairly sane rules, and tend to come up with pretty much the
same ordering.

ChrisA



More information about the Python-list mailing list