Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

See similar issue for SimpleNamespace: https://bugs.python.org/issue31655.

We should add a similar check in str.format(). Accepting a non-string keys is 
an implementation detail. There is no guarantee that it works in other 
implementations.

It should not hit performance, because the kwargs dict is usually small, the 
check is cheap, and formatting itself can be expensive. For the case when you 
need to pass a huge dict and use only few items from it, you can use 
str.format_map().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39694>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to