[issue8134] collections.defaultdict gives KeyError with format()

2010-03-13 Thread Greg Jednaszewski
New submission from Greg Jednaszewski jednaszew...@gmail.com: Found on 2.6.2 and 2.6.4: I expect that printing an uninitialized variable from a defaultdict should work. In fact it does with old-style string formatting. However, when you try to do it with new-style string formatting, it

[issue8134] collections.defaultdict gives KeyError with format()

2010-03-13 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +eric.smith, ezio.melotti priority: - normal stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8134 ___

[issue8134] collections.defaultdict gives KeyError with format()

2010-03-13 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: str.format() does not take a mapping object. You want: {0[foo]}.format(d) '0' -- resolution: - invalid stage: test needed - committed/rejected status: open - closed ___ Python tracker

[issue8134] collections.defaultdict gives KeyError with format()

2010-03-13 Thread Greg Jednaszewski
Greg Jednaszewski jednaszew...@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

[issue8134] collections.defaultdict gives KeyError with format()

2010-03-13 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: No, because that's not the behavior of keyword arguments. -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8134

[issue8134] collections.defaultdict gives KeyError with format()

2010-03-13 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: See also issue 6081. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8134 ___ ___