0

I noticed earlier that when you call help on functions like math.pow or math.sqrt or most of the other functions in math (not all though). I can't seem to find any information about what this means, since its not present in the online docs and these functions don't accept an extra argument. Does anyone know what this means?

Example of what happens when calling help on math.pow:

>>> help(math.pow)
Help on built-in function pow in module math:

pow(x, y, /)
    Return x**y (x to the power of y).

I expected that the signature would be pow(x, y) since those are the only 2 arguments accepted. However this / argument is present as well.

  • 4
    Duplicate of [What is the meaning of a forward slash "/" in a Python method signature, as shown by help(foo)?](https://stackoverflow.com/questions/28243832/what-is-the-meaning-of-a-forward-slash-in-a-python-method-signature-as-show). Basically it's marking the end of positional arguments. – blackbrandt Oct 27 '22 at 18:29
  • 1
    I believe it means the arguments before it are "positional only": https://www.tutorialspoint.com/what-does-the-slash-in-the-parameter-list-of-a-function-mean-in-python . Meaning, you can not do `math.pow(x=2, y=3)` – Savir Oct 27 '22 at 18:29
  • Also, where do you see this? When I do `>help(pow))`, I get: `pow(base, exp, mod=None) ` – Cargo23 Oct 27 '22 at 18:30
  • 1
    @Cargo23 pow vs math.pow – Sören Oct 27 '22 at 18:31
  • 1
    @Cargo23 use `help(math.pow)`. This doesn't show up on the builtin not stdlib functions. – superspeeder101 Oct 27 '22 at 18:31

0 Answers0