1 Nov
2018
1 Nov
'18
12:45 p.m.
31.10.18 13:08, Antoine Pitrou пише:
+1 from me. dict.pop() already has an optional default. This is a straight-forward improvement to the API and no Python programmer will be surprised.
list.pop() corresponds two dict methods. With argument it corresponds dict.pop(). But there are differences: dict.pop() called repeatedly with the same key will raise an error (or return the default), while list.pop() will likely return other item. Without argument it corresponds dict.popitem() which doesn't have an optional default.