6

This works

numpy.multiply(13, 3)

This doesn't

numpy.multiply(x1=13, x2=3)

It raises an invalid number of arguments exception. Can someone explain why please. I tried to follow the documentation but got a bit lost with the /, and * characters which are included in the argument list. If you could explain the meaning of these too it would be appreciated.

Sociopath
  • 13,068
  • 19
  • 47
  • 75
Jinglesting
  • 509
  • 5
  • 16
  • 3
    Arguments before the slash are positional only, so you cannot pass them as keyword arguments; read the help(range) question for more details. – YSelf Feb 27 '18 at 13:23

1 Answers1

7

https://docs.scipy.org/doc/numpy/reference/generated/numpy.multiply.html

The / and * delimit positional-only and keyword-only arguments, respectively. Any arguments listed before the / can only be given as positional arguments, with no keyword (i.e. no x1, x2). Arguments listed after the * can only be given with a keyword.

Keyword-Only Arguments

Positional-Only Arguments

llllllllll
  • 16,169
  • 4
  • 31
  • 54
Mark Whitfield
  • 2,470
  • 1
  • 12
  • 12