I was contributing to a library on Github, and came across the "/" parameter as a function parameter. The function is quite wide and complex, so as not to confuse, I will create a simple one as an example.
def funcion_suma(a, b, /, c, d):
return a + b + c + d
print(funcion_suma(1,2,3,4))
Departure: 10
For a second I thought it was a parameter, but no, the function has 4 parameters a , b , c and d . The slash (/) is simply performing some kind of operation.
Of course, if we define the function without the slash it works just the same and gives the same result:
def funcion_suma(a, b, c, d):
return a + b + c + d
print(funcion_suma(1,2,3,4))
Departure: 10
What is this kind of syntax for?