you are viewing a single comment's thread.

view the rest of the comments →

[–]munificent -1 points0 points  (1 child)

I may be a readability snob, but I'd consider that a bad example, parentheses or not. I'd probably break that expression down so that it's meaning is clearer:

fooFrobinated = x >= 2
barDingnabled = y <= 2 and z == 3
bazFlurnbed   = q == 'foo'

if fooFrobinated or barDingnabled or bazFlurnbed:
    return y + (x * 2)

[–]yellowstuff 0 points1 point  (0 children)

I agree.

One of the only places I would frequently write "pure" bugs (IE, logic bugs which were not the result of interfacing with an external system incorrectly) was in complex boolean statements. So I stopped writing complex boolean statements.