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

2010-03-13 Thread Eric Smith
Eric Smith added the comment: See also issue 6081. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

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

2010-03-13 Thread Benjamin Peterson
Benjamin Peterson added the comment: No, because that's not the behavior of keyword arguments. -- nosy: +benjamin.peterson ___ Python tracker ___

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

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

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

2010-03-13 Thread Eric Smith
Eric Smith 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 Ezio Melotti
Changes by Ezio Melotti : -- nosy: +eric.smith, ezio.melotti priority: -> normal stage: -> test needed ___ Python tracker ___ ___ Pyt

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

2010-03-13 Thread Greg Jednaszewski
New submission from Greg Jednaszewski : 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 raises a KeyError. >>> imp