Is it possible/Is there a way to iterate through a sequence of operators as in the following example?
a, b = 5, 7
for op in (+, -, *, /):
print(a, str(op), b, a op b)
One possible use case is the test of the implementation of various operators on some abstract data type where these operators are overloaded.
Try this:
Hope this helps!
You can create your own operations, then iterate through them.
You can use the operator module.