This repository was archived by the owner on Jul 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -304,6 +304,23 @@ another).
304304Mapping type
305305============
306306
307+ A mapping object maps hashable values to arbitrary objects. Mappings are
308+ mutable objects. There is currently ony one standard mapping type, the
309+ *dictionary*. In few words mappings are collections of keys and their values.
310+
311+ A dictionary's keys are almost arbitrary values. Values that are not hashable
312+ may not be used as keys. Values that compare equal (such as ``1``, ``1.0`` and
313+ ``True``) can be used interchangeably to index the same dictionary entry.
314+
315+ Dictionaries can be created by several means:
316+
317+ - Use braces to denote the empty dictionary: ``{}``
318+ - Use a comma-separated list of ``key: value`` pairs with braces:
319+ ``{'first_name': 'Serhii', 'last_name': 'Horodilov', 'age': 34}
320+ - Use a dict comprehension: `{x: x ** 2 for x in range(10)}``
321+ - Use the type constructor: ``dict()``, ``dict([('key', 100)])``,
322+ ``dict(key=100)``
323+
307324Value comparisons
308325-----------------
309326
You can’t perform that action at this time.
0 commit comments