This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Akos Kiss, ammar2, eric.smith, iritkatriel, rhettinger, serhiy.storchaka
Date 2021-12-09.02:41:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1639017699.23.0.8568072489.issue39694@roundup.psfhosted.org>
In-reply-to
Content
IMO, there is no actual problem being solved here.  Instead there is just a concern that something doesn't feel right.   Given that there is no problem in practice, I recommend closing this rather than cluttering docs, tests, or the C code for a non-issue.  

The format() method looksup keywords on demand and it can only lookup strings.  Anything not looked up is ignored.  We have a long history of that working out just fine:

     >>> 'The answer is %(answer)s.' % \
         {'answer': 'correct', 10: 'never used'}
     'The answer is correct.'

     >>> 'The answer is {answer}.'.format(
          **{'answer': 'correct', 10: 'never used'})
     'The answer is correct.'

     >>> 'The answer is {answer}.'.format_map(
         {'answer': 'correct', 10: 'never used'})
     'The answer is correct.

One could argue that making any of the above raise an error for a non-string in a dict is backwards incompatible and would only serve to break code that is already working fine.

I'm going to close this one.  If another core dev feels strongly that this is a problem in practice, go ahead and reopen it.  There was a similar change to SimpleNamespace but arguably that shouldn't have been done either, but at least it had much less risk of breaking existing code that has worked fine for over a decade.
History
Date User Action Args
2021-12-09 02:41:39rhettingersetrecipients: + rhettinger, eric.smith, serhiy.storchaka, ammar2, Akos Kiss, iritkatriel
2021-12-09 02:41:39rhettingersetmessageid: <1639017699.23.0.8568072489.issue39694@roundup.psfhosted.org>
2021-12-09 02:41:39rhettingerlinkissue39694 messages
2021-12-09 02:41:38rhettingercreate