News for hackers. Stuff that matters.
Re:GCC 6: -Wmisleading-indentation vs. “goto fail;” by wting on Tuesday March 08, 2016 @10:26PM (#11250685)
Kinda late but I want to point out these snippets have different behaviors:

    if A and B:
        ..
    elif B:
        ..
vs

    if A and B:
       ..
    elif A and not B:
       ..
I prefer flattening because enumeration makes it obvious what's different between the branches despite the code duplication.

For example, three boolean conditions has 2^3 = 8 possible combinations. When nested this complexity is hidden but obviously apparent as a code smell when flattened.

It also echoes Python's ethos that flat is better than nested.

There are no comments on this comment yet.