Created
October 31, 2026 20:25
-
-
Save mypy-play/084d01434c9b7458642e9ee750b427ee to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def func_with_kw_only(x: int, *, y: int = 0): | |
| return x + y | |
| def func_with_pos_only(x: int, y: int, /): | |
| return x + y | |
| func_with_kw_only(1) # OK | |
| func_with_kw_only(1, y=2) # OK | |
| func_with_kw_only(1, 2) # error: Too many positional arguments for "func_with_kw_only" [call-arg] | |
| func_with_pos_only(1, 2) # OK | |
| func_with_pos_only(1, y=2) # error: Unexpected keyword argument "y" for "func_with_pos_only" [call-arg] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment