Created
March 17, 2020 06:56
-
-
Save mahmoud/388f2e1d7804511c8fec3c90316d9d16 to your computer and use it in GitHub Desktop.
TIL py3 partials don't mind multiple values for arguments
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 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