[issue6081] str.format_from_mapping()

Filip Gruszczyński report at bugs.python.org
Fri Mar 19 23:33:15 CET 2010


Filip Gruszczyński <gruszczy at gmail.com> added the comment:

Ok, unfortunately this code won't work for certain tests. Take those:

        self.assertEqual("My name is {0}".format('Fred'), "My name is Fred")

We pass only one argument, which is a dict and this won't satisfy such test. We need to think about a different way of passing those arguments there. We can do one of two thins:
* the last argument of args tuple would be an object that can be subscripted for format values
* keyword with above object

I believe the second version is more explicit and therefore better.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6081>
_______________________________________


More information about the Python-bugs-list mailing list