Lines Matching refs:dict

2 alternatives to Python's general purpose built-in containers, dict,
7 * ChainMap dict-like class for creating a single view of multiple mappings
8 * Counter dict subclass for counting hashable objects
9 * OrderedDict dict subclass that remembers the order entries were added
10 * defaultdict dict subclass that calls a factory function to supply missing values
11 * UserDict wrapper around dictionary objects for easier dict subclassing
78 class OrderedDict(dict):
80 # An inherited dict maps keys to values.
81 # The inherited dict provides __getitem__, __len__, __contains__, and get.
85 # The internal self.__map dict maps keys to links in a doubly linked list.
107 dict_setitem=dict.__setitem__, proxy=_proxy, Link=_Link):
120 def __delitem__(self, key, dict_delitem=dict.__delitem__):
156 dict.clear(self)
178 value = dict.pop(self, key)
210 size += sizeof(self.__map) * 2 # internal dict and inherited dict
240 result = dict.pop(self, key, marker)
310 return dict.__eq__(self, other) and all(map(_eq, self, other))
311 return dict.__eq__(self, other)
318 if not isinstance(other, dict):
325 if not isinstance(other, dict):
413 field_defaults = dict(reversed(list(zip(reversed(field_names),
424 _dict, _tuple, _len, _map, _zip = dict, tuple, len, map, zip
464 'Return a new dict which maps field names to their values.'
534 class Counter(dict):
644 # Override dict methods where necessary
654 # comprehension or dict.fromkeys().
659 '''Like dict.update() but add counts instead of replacing them.
671 # The regular dict.update() operation makes no sense here because the
693 '''Like dict.update() but subtracts counts instead of replacing them.
724 return self.__class__, (dict(self),)
727 'Like dict.__delitem__() but does not raise KeyError for missing values.'
735 # dict() preserves the ordering returned by most_common()
736 d = dict(self.most_common())
739 d = dict(self)
1015 d.update(dict.fromkeys(mapping)) # reuses stored hash values if possible
1030 'Create a ChainMap with a single dict created from the iterable.'
1031 return cls(dict.fromkeys(iterable, *args))
1041 If no map is provided, an empty dict is used.
1042 Keyword arguments update the map or new empty dict.
1096 m = dict(other)
1109 def __init__(self, dict=None, /, **kwargs):
1111 if dict is not None:
1112 self.update(dict)
1146 if isinstance(other, dict):
1153 if isinstance(other, dict):