[docs] [issue9805] Documentation on old-style formatting of dicts is overly restrictive
Ken Basye
report at bugs.python.org
Thu Sep 9 00:29:00 CEST 2010
Ken Basye <ken.basye at gmail.com> added the comment:
If someone's going to fix this, perhaps they might consider also adding the following clarification sentence after 'The mapping key selects the value to be formatted from the mapping.'
The mapping key is interpreted as a string; a key error is raised if the dictionary does not have a matching string key.
I don't think it's worth adding it, but consider this example:
>>> d = {2:2, '2':'two'}
>>> '%(2)s' % d
'two'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9805>
_______________________________________
More information about the docs
mailing list