[issue8134] collections.defaultdict gives KeyError with format()
Greg Jednaszewski
report at bugs.python.org
Sun Mar 14 00:46:20 CET 2010
Greg Jednaszewski <jednaszewski at gmail.com> added the comment:
Oops, thanks. I should have known that. However, should this work? This is what initially led me to file this ticket. My initial example was a bad one.
>>> from collections import defaultdict
>>> d = defaultdict(int)
>>> d['bar'] += 1
>>> "{bar}".format(**d)
'1'
>>> "{foo}".format(**d)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'foo'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8134>
_______________________________________
More information about the Python-bugs-list
mailing list