[Tutor] What is meaning of "/" in "pow(x, y, z=None, /)"?
Ben Finney
ben+python at benfinney.id.au
Tue Aug 1 21:25:34 EDT 2017
Steven D'Aprano <steve at pearwood.info> writes:
> Its quite new. Up until recently, the documentation didn't distinguish
> between function parameters which can take optional keywords and those
> that can't.
Where does the documentation describe this distinction? How is the
reader, coming across a link to documentation for a function, expected
to know what that symbol means in that context?
I am dismayed that the documentation has gone from describing function
signatures in Python syntax, to describing function signatures that
don't have the expected effect in Python code.
Python 3.6.2 (default, Jul 17 2017, 16:44:45)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo(lorem, /, ipsum):
File "<stdin>", line 1
def foo(lorem, /, ipsum):
^
SyntaxError: invalid syntax
--
\ “Ignorance more frequently begets confidence than does |
`\ knowledge.” —Charles Darwin, _The Descent of Man_, 1871 |
_o__) |
Ben Finney
More information about the Tutor
mailing list