Document `__foo` syntax for positional-only args (#147)

This commit is contained in:
Naomi Seyfer 2016-12-03 16:02:52 -08:00 committed by Brett Cannon
parent a28b7995ca
commit 26b4086667
1 changed files with 15 additions and 0 deletions

View File

@ -1268,6 +1268,21 @@ In such cases the default value may be specified as a literal
ellipsis, i.e. the above example is literally what you would write.
Positional-only arguments
-------------------------
Some functions are designed to take their arguments only positionally,
and expect their callers never to use the argument's name to provide
that argument by keyword. All arguments with names beginning with
``__`` are assumed to be positional-only::
def quux(__x: int) -> None: ...
quux(3) # This call is fine.
quux(__x=3) # This call is an error.
Annotating generator functions and coroutines
---------------------------------------------