jeudi 22 octobre 2020

python stability of complex conditionals

I have a piece of python code that can have several valid indentation patterns and its behavior changed by hitting accidentally hitting 'tab' and shifting 'elif X' on indentation to the right.

    if A:
        do_a()
        if B:
            do_b()
        elif C:
            do_c()
    elif X:
            do_x()

Is it advisable to always add 'else' cases with 'pass'?

Aucun commentaire:

Enregistrer un commentaire