0

I've recently noticed that when defining a function in python, you can use a single / in the argument list, to apparently no effect

>>> def f(a,b):
...     return a
... 
>>> f(1,2)
1
>>> def g(a,/,b):
...     return a
... 
>>> g(1,2)
1
>>> g.__code__.co_varnames
('a', 'b')
>>> def h(a,/,b,/,c):
  File "<stdin>", line 1
    def h(a,/,b,/,c):
                ^
SyntaxError: invalid syntax

As you can see, only one is accepted. It also seems like the fact that / was used in the original argument list isn't reflected in the final function.

What's its use/purpose?

0 Answers0