Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

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.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
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