Consider you have two functions func1 and func2, where func2 is the fallback option for func1. However, you can also choose by a flag to always go for func2. Is there a way to avoid redundant code and unite except/else since they have the same content?
if func1_flag == true:
try:
func1()
except:
func2()
else:
func2()
Aucun commentaire:
Enregistrer un commentaire