While running a trading algorithm, I ran into the following issue that I tried to reproduce in the following way:
Suppose I have one algorithm named algo1.py and another named algo2.py.
Here's algo2.py...
class mathOperations():
def __init__(self):
self.value = 0
def sum(self, __a = 0, __b = 0):
return (__a + __b)
Here's algo1.py...
from algo2 import mathOperations
math = mathOperations()
print(math.sum(__a = 56, __b = 44))
When I run algo1.py, I get the following message:
Traceback (most recent call last):
File "algo1.py", line 5, in <module>
print(math.sum(__a = 56, __b = 67))
TypeError: sum() got an unexpected keyword argument '__a'
However, when I remove the '__' or two underscores from the front of the named arguments in both algorithms, this error goes away. Could someone please explain to me why?