Skip to content

Commit ef3f9bf

Browse files
committed
add comment
1 parent 54479ee commit ef3f9bf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

conformance/tests/historical_positional.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@ def f1(__x: int, __y__: int = 0) -> None: ...
2626
def f2(x: int, __y: int) -> None: ... # E
2727

2828

29+
# `x` is a positional-or-keyword parameter, so,
30+
# according to a literal reading of the above rule, `__y`
31+
# should be flagged as an error since it uses the historical
32+
# convention for positional-only parameters but appears after
33+
# a positional-or-keyword parameter that does not. We therefore
34+
# permit type checkers to emit an error on this definition.
35+
#
36+
# Note that `x` can only be passed with a keyword argument if
37+
# no arguments are passed positionally:
38+
#
39+
# ```pycon
40+
# >>> def f3(x: int, *args: int, __y: int) -> None: ...
41+
# ...
42+
# >>> f3(x=1, __y=2)
43+
# >>>
44+
# ```
2945
def f3(x: int, *args: int, __y: int) -> None: ... # E?
3046

3147

0 commit comments

Comments
 (0)