[issue13598] string.Formatter doesn't support empty curly braces "{}"
Phil Elson
report at bugs.python.org
Mon Mar 4 13:09:06 CET 2013
Phil Elson added the comment:
> I didn't see a test case relating to the example in his comment, namely
>
> f.format("{0:{}}", 'foo', 5)
>
> Did I miss it?
The example should fail, which it wouldn't have done with the patch previously proposed. I believe the case is covered by the block:
with self.assertRaises(ValueError):
fmt.format("foo{1}{}", "bar", 6)
Though there is no harm in adding another test along the lines of:
with self.assertRaises(ValueError):
fmt.format("{0:{}}", "bar", 6)
If you think it is worthwhile?
I'm uncertain which documentation to update since the method which has had its signature updated is private and is called solely by Formatter.vformat .
Cheers,
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13598>
_______________________________________
More information about the Python-bugs-list
mailing list