From 26b40866671be5ca0543d97206de357b22d87553 Mon Sep 17 00:00:00 2001 From: Naomi Seyfer Date: Sat, 3 Dec 2016 16:02:52 -0800 Subject: [PATCH] Document `__foo` syntax for positional-only args (#147) --- pep-0484.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pep-0484.txt b/pep-0484.txt index dd1f89a5c..b2cd6e147 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -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 ---------------------------------------------