Skip to content

Commit

Permalink
Update README with new freeze documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-arh authored and npfbdevopslead committed Sep 14, 2020
1 parent 6522a4e commit 47cf40a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.rst
Expand Up @@ -559,6 +559,20 @@ These functions are great when your cozy immutable world has to interact with th
>>> thaw(v(1, m(a=3)))
[1, {'a': 3}]
By default, freeze will also recursively convert values inside PVectors and PMaps. This behaviour can be changed by providing freeze with the flag nonstrict=True.
.. code:: python
>>> from pyrsistent import freeze, v, m
>>> freeze(v(1, v(2, [3])))
pvector([1, pvector([2, pvector([3])])])
>>> freeze(v(1, v(2, [3])), nonstrict=True)
pvector([1, pvector([2, [3]])])
>>> freeze(m(a=m(b={'c': 1})))
pmap({'a': pmap({'b': pmap({'c': 1})})})
>>> freeze(m(a=m(b={'c': 1})), nonstrict=True)
pmap({'a': pmap({'b': {'c': 1}})})
Compatibility
-------------
Expand Down

0 comments on commit 47cf40a

Please sign in to comment.