When passing **kwargs to a callable, the expectation is that kwargs is a dict with string keys. The interpreter enforces that it's a dict, but it does NOT check the types of the keys. It's currently the job of the called function to check that. In some cases, this check is not applied:

>>> from collections import OrderedDict
>>> OrderedDict(**{1:2})
OrderedDict([(1, 2)])

So this leads to the question: should the interpreter check the keys of a **kwargs dict?

I don't have an answer myself, I'm just asking the question because it comes up in https://github.com/python/cpython/pull/13930 and https://github.com/python/cpython/pull/14589


Jeroen.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/7CYDQX5T53XK7TWPV3MTYPTHM2KFUBWS/

Reply via email to