I have the simple Python 3 expression:
if a:
b = a
else:
print('error')
However in my case, it just so happens that 'a' is equal to a very verbose but necessary regex search command (not relevant here.) Can I simplify the above code so that:
1) I don't need to assign a value to 'a'.
2) I don't need to state the value of 'a' twice in the expression.
Thanks!
b = a or b. But I would assign the result to a temporary variable.