Skip to content

Instantly share code, notes, and snippets.

@mahmoud
Created March 17, 2020 06:56
Show Gist options
  • Save mahmoud/388f2e1d7804511c8fec3c90316d9d16 to your computer and use it in GitHub Desktop.
Save mahmoud/388f2e1d7804511c8fec3c90316d9d16 to your computer and use it in GitHub Desktop.
TIL py3 partials don't mind multiple values for arguments
>>> def f(a, b):
... return a, b
...
# py27
>>> partial(f, b=1)(1, 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: f() got multiple values for keyword argument 'b'
# py37
>>> partial(f, b=1)(a=1, b=2)
(1, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment