[docs] [issue9805] Documentation on old-style formatting of dicts is overly restrictive
report at bugs.python.org
Thu Sep 9 00:08:38 CEST 2010
New submission from Ken Basye <ken.basye at gmail.com>:
>From http://docs.python.org/library/stdtypes.html#string-formatting-operations :
"When the right argument is a dictionary (or other mapping type), then the formats in the string must include a parenthesised mapping key into that dictionary inserted immediately after the '%' character."
(with emphasis on 'must' in the HTML, BTW).
This isn't correct: "%s" % dict() is a perfectly legal expression with a dictionary as the right argument and no mapping key in the formats. Indeed, if the current doc were correct, there would apparently be no way to format an empty dictionary.
How about this one-word fix:
"When the right argument is a dictionary (or other mapping type), then the formats in the string may include ..." and so on into the next sentence, and no emphasis on 'may'.
P.S. Not sure about the Type of this issue, and it's present in both 2.7 and current 3.X doc.
assignee: docs at python
nosy: Ken.Basye, docs at python
title: Documentation on old-style formatting of dicts is overly restrictive
versions: Python 2.7
Python tracker <report at bugs.python.org>
More information about the docs