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
  • 12,395
  • 17
  • 43
  • 69
Jinglesting
  • 493
  • 4
  • 14
  • 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
  • 15,580
  • 4
  • 25
  • 47
Mark Whitfield
  • 2,322
  • 1
  • 11
  • 12