[issue25016] defaultdict's pop gives a KeyError

2015-09-07 Thread R. David Murray
R. David Murray added the comment: It would not be sensible for pop to return the default value, since the point of pop is to *remove* a key from the dictionary (while returning the existing value), whereas the point defaultdict is to *add* key to the dictionary with the default value if you r

[issue25016] defaultdict's pop gives a KeyError

2015-09-06 Thread Martin Panter
Martin Panter added the comment: I think this is by design. Under it says “__missing__() is _not_ called for any operations besides __getitem__().” What gave you the impression that pop() should return a d

[issue25016] defaultdict's pop gives a KeyError

2015-09-06 Thread Chase Albert
New submission from Chase Albert: `defaultdict(list).pop(1)` raises a KeyError, this is not what I expected (I expected an empty list). -- components: Library (Lib) messages: 250080 nosy: rob.anyone priority: normal severity: normal status: open title: defaultdict's pop gives a KeyError