Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
>>> def by_id(id, **kwargs):
... print(id, kwargs)
...
>>> by_id({'id': 1, 'foobaz': 2, 'bazfoo': 3})
{'foobaz': 2, 'bazfoo': 3, 'id': 1} {}
>>> by_id(**{'id': 1, 'foobaz': 2, 'bazfoo': 3})
1 {'foobaz': 2, 'bazfoo': 3}
>>> by_id(1, **{'id': 1, 'foobaz': 2, 'bazfoo': 3})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: by_id() got multiple values for argument 'id'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment