[Tutor] What is meaning of "/" in "pow(x, y, z=None, /)"?
Steven D'Aprano
steve at pearwood.info
Tue Aug 1 21:15:35 EDT 2017
On Tue, Aug 01, 2017 at 08:06:58PM -0500, boB Stepp wrote:
> pow(x, y, z=None, /)
> Equivalent to x**y (with two arguments) or x**y % z (with three arguments)
It means that the arguments are positional-only, the names "x", "y" and
"z" are for documentation purposes only. You cannot write:
pow(x=2, y=3)
but only
pow(2, 3)
> A quick scan of some of my Python books does not turn up the use of
> "/" as a function argument.
Its quite new. Up until recently, the documentation didn't distinguish
between function parameters which can take optional keywords and those
that can't.
--
Steve
More information about the Tutor
mailing list