File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 4444are hashable, comparable, and pickleable.
4545
4646The ``Map `` object implements the ``collections.abc.Mapping `` ABC
47- so working with it is very similar to working with Python dicts.
47+ so working with it is very similar to working with Python dicts:
48+
49+ .. code-block :: python
4850
4951 import immutables
5052
@@ -60,7 +62,9 @@ so working with it is very similar to working with Python dicts.
6062 # will print 'False'
6163
6264 Since Maps are immutable, there is a special API for mutations that
63- allow apply changes to the Map object and create new (derived) Maps::
65+ allow apply changes to the Map object and create new (derived) Maps:
66+
67+ .. code-block :: python
6468
6569 map2 = map .set(' a' , 10 )
6670 print (map , map2)
@@ -75,7 +79,9 @@ allow apply changes to the Map object and create new (derived) Maps::
7579 # <immutables.Map({'a': 10, 'b': 2})>
7680 # <immutables.Map({'a': 10})>
7781
78- Maps also implement APIs for bulk updates: ``MapMutation `` objects::
82+ Maps also implement APIs for bulk updates: ``MapMutation `` objects:
83+
84+ .. code-block :: python
7985
8086 map_mutation = map .mutate()
8187 map_mutation[' a' ] = 100
@@ -90,7 +96,9 @@ Maps also implement APIs for bulk updates: ``MapMutation`` objects::
9096 # <immutables.Map({'a': 100, 'y': 'y'})>
9197
9298 ``MapMutation `` objects are context managers. Here's the above example
93- rewritten in a more idiomatic way::
99+ rewritten in a more idiomatic way:
100+
101+ .. code-block :: python
94102
95103 with map .mutate() as mm:
96104 mm[' a' ] = 100
You can’t perform that action at this time.
0 commit comments