From: Daniel Greenfeld Date: Sat, 17 May 2014 23:36:42 +0000 (-0700) Subject: Final Readme tweak of the day X-Git-Tag: 0.1.2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e648e87edefbe5f714263b4b80ed5cfa47419bc;p=cached-property.git Final Readme tweak of the day --- diff --git a/README.rst b/README.rst index 9280720..4bb0a56 100644 --- a/README.rst +++ b/README.rst @@ -27,8 +27,8 @@ Why? How to use it -------------- -Define a class with an expensive property. Every time you stay there the -price goes up by $50. I +Let's define a class with an expensive property. Every time you stay there the +price goes up by $50! .. code-block:: python @@ -48,10 +48,10 @@ Now run it: .. code-block:: python - >>> m = Monopoly() - >>> m.boardwalk + >>> monopoly = Monopoly() + >>> monopoly.boardwalk 550 - >>> m.boardwalk + >>> monopoly.boardwalk 600 Let's convert the boardwalk property into a `cached_property`. @@ -77,12 +77,12 @@ Now when we run it the price stays at $550. .. code-block:: python - >>> m = Monopoly() - >>> m.boardwalk + >>> monopoly = Monopoly() + >>> monopoly.boardwalk 550 - >>> m.boardwalk + >>> monopoly.boardwalk 550 - >>> m.boardwalk + >>> monopoly.boardwalk 550 Why doesn't the value of `m.boardwalk` change? Because it's a **cached property**! @@ -92,4 +92,4 @@ Credits * Django, Werkzueg, Bottle, and Zope for having their own implementations. This package uses the Django version. * Reinout Van Rees for pointing out the cached_property decorator to me. -* My awesome wife Audrey who created cookiecutter, which meant rolling this out took me just 15 minutes. \ No newline at end of file +* My awesome wife Audrey who created cookiecutter, which meant rolling this out took me just 15 minutes.