From a617e2f24c994a7c57e4ed19dea6f95a95f0639a Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Tue, 20 Nov 2018 14:27:07 -0500 Subject: Fix README markup --- README.rst | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 203f529..35845d6 100644 --- a/README.rst +++ b/README.rst @@ -44,7 +44,9 @@ API are hashable, comparable, and pickleable. The ``Map`` object implements the ``collections.abc.Mapping`` ABC -so working with it is very similar to working with Python dicts. +so working with it is very similar to working with Python dicts: + +.. code-block:: python import immutables @@ -60,7 +62,9 @@ so working with it is very similar to working with Python dicts. # will print 'False' Since Maps are immutable, there is a special API for mutations that -allow apply changes to the Map object and create new (derived) Maps:: +allow apply changes to the Map object and create new (derived) Maps: + +.. code-block:: python map2 = map.set('a', 10) print(map, map2) @@ -75,7 +79,9 @@ allow apply changes to the Map object and create new (derived) Maps:: # # -Maps also implement APIs for bulk updates: ``MapMutation`` objects:: +Maps also implement APIs for bulk updates: ``MapMutation`` objects: + +.. code-block:: python map_mutation = map.mutate() map_mutation['a'] = 100 @@ -90,7 +96,9 @@ Maps also implement APIs for bulk updates: ``MapMutation`` objects:: # ``MapMutation`` objects are context managers. Here's the above example -rewritten in a more idiomatic way:: +rewritten in a more idiomatic way: + +.. code-block:: python with map.mutate() as mm: mm['a'] = 100 -- cgit v1.2.3