Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion conformance/tests/historical_positional.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,23 @@ def f1(__x: int, __y__: int = 0) -> None: ...
def f2(x: int, __y: int) -> None: ... # E


def f3(x: int, *args: int, __y: int) -> None: ... # OK
# `x` is a positional-or-keyword parameter, so,
# according to a literal reading of the above rule, `__y`
# should be flagged as an error since it uses the historical
# convention for positional-only parameters but appears after
# a positional-or-keyword parameter that does not. We therefore
# permit type checkers to emit an error on this definition.
#
# Note that `x` can only be passed with a keyword argument if
# no arguments are passed positionally:
#
# ```pycon
# >>> def f3(x: int, *args: int, __y: int) -> None: ...
# ...
# >>> f3(x=1, __y=2)
# >>>
# ```
def f3(x: int, *args: int, __y: int) -> None: ... # E?


f3(3, __y=3) # OK
Expand Down