Duplicate declaration of functions (multiple signatures)
def add(x, y):
return x*y
print(add(2, 3)) # 6
def add(x):
return x+x
print(add(2)) # 4
add(2, 3)
# TypeError: add() takes exactly 1 argument (2 given)
Output:
4
Traceback (most recent call last):
File "examples/functions/duplicate_add.py", line 9, in <module>
add(2, 3)
TypeError: add() takes 1 positional argument but 2 were given
The second declaration silently overrides the first declaration.