What is the best way to implement the following code without having the same code duplicated in two different blocks, but while maintaining efficiency and readability?if (expression1):    if (expression2 that can only be checked if expression1):        doSomething()    else:        doSomethingElse()else:    doSomethingElse()
How to complete a task in two seperate 'else' statements while maintaining DRY
design patterns;python
if( expression1 and expression2): doSomething()else: doSomethingElse()Since Python supports short-circuit evaluation, Expression2 will only be evaluated if expression1 is true. 