Last active
May 5, 2020 21:28
-
-
Save erip/42cb83e9a9b82e294cb338686f6563f6 to your computer and use it in GitHub Desktop.
Some dumb thing
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
| class Something: | |
| def __init__(*args, **kwargs): | |
| pass | |
| def foo(a=None, b=None, c=None, d=100): | |
| # We can't add *args and Something specific **kwargs to above signature | |
| # since *args need to come before **kwargs | |
| something = Something() | |
| # | |
| def _foo_helper(a, b, c, d, *args, **kwargs): | |
| something = Something(*args, **kwargs) | |
| def foo2(*args, **kwargs): | |
| a, b, c, d = kwargs.pop('a', None), kwargs.pop('b', None), kwargs.pop('c', None) kwargs.pop('d', 100) | |
| _foo_helper(a, b, c, d, *args, **kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment