Skip to content

Instantly share code, notes, and snippets.

@edenau
Last active January 23, 2020 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edenau/a56148f29f30dc48f9f74aa8f6128823 to your computer and use it in GitHub Desktop.
Save edenau/a56148f29f30dc48f9f74aa8f6128823 to your computer and use it in GitHub Desktop.
def my_func(a, b, /, c, d, *, e, f):
return a+b+c+d+e+f
my_func(1,2,3,4,5,6) # invalid as e and f are keyword-only
my_func(a=1,b=2,3,4,e=5,f=6) # invalid as a and b are position-only
my_func(1,2,3,d=4,e=5,f=6) # returns 21
my_func(1,2,c=3,d=4,e=5,f=6) # returns 21
@uselessscat
Copy link

uselessscat commented Jan 23, 2020

In python 3.8.1 the line 6 returns SyntaxError: positional argument follows keyword argument

The line 7 says my_unc

Thanks for the article

@edenau
Copy link
Author

edenau commented Jan 23, 2020

In python 3.8.1 the line 6 returns SyntaxError: positional argument follows keyword argument

The line 7 says my_unc

Thanks for the article

Fixed. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment