my_first_calculator.py
my_first_calculator.py copied to clipboard
Increase efficiency trough the replacement of if with elif statements.
Although I know that this probably already is the most efficient calculator ever written by intelligent life forms, I belive that we could make it even more efficient trough replacing the if statements after the first calculation with elif statements to reduce execution overhead that happens when checking if conditions that can't possibly be true anymore.
Because the code is already so efficient I don't belive that this change will bring a noticeable performance increase but it's good prarice anyway so we should implement it.
Okay just saw the comment in generator.py but I will keep working on a way to circumvent the recursive error. Maybe starting every big if block for a certain mathematical operation with a new if and replacing the rest with elif could work?