2

When I use the help function on a builtin magic method, there is often a / in the function signature.

>>> help(int.__add__)
Help on wrapper_descriptor:

__add__(self, value, /)
    Return self+value.

However, when I apply the help function to a either a standard builtin method, or a user-defined magic method, there is no / in the function signature.

>>> help(list.append)
Help on method_descriptor:

append(...)
    L.append(object) -> None -- append object to end

>>> class c:
        def __add__(self, other): return 1

>>> help(c.__add__)
Help on function __add__ in module __main__:

__add__(self, other)

What does the / in the method signature indicate?

Joshua
  • 2,431
  • 15
  • 23

0 Answers0