DictReadOnly#
Bases:
Mapping
Read-only dictionary. Prevents accidental write-backs to dictionary.
- Parameters:
data (dict) – The dictionary to be wrapped in a read-only interface.
Methods
__init__
(data)Initializes the DictReadOnly instance.
copy
()Creates a shallow copy of the read-only dictionary.
merge_dict
(other)Merges another dictionary into the current read-only dictionary.
Initializes the DictReadOnly instance.
Creates a shallow copy of the read-only dictionary.
- Returns:
A new DictReadOnly instance with copied data.
- Return type:
Merges another dictionary into the current read-only dictionary.
- Parameters:
other (dict) – The dictionary to merge with the current dictionary.
- Returns:
A new DictReadOnly instance with merged data.
- Return type: