Skip to content

Commit

Permalink
Fix README indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pydanny authored Sep 21, 2020
1 parent 0be6adc commit 4adb332
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ Let's define a class with an expensive property. Every time you stay there the
price goes up by $50!

```python
class Monopoly(object):
class Monopoly(object):

def __init__(self):
self.boardwalk_price = 500
def __init__(self):
self.boardwalk_price = 500

@property
def boardwalk(self):
# In reality, this might represent a database call or time
# intensive task like calling a third-party API.
self.boardwalk_price += 50
return self.boardwalk_price
@property
def boardwalk(self):
# In reality, this might represent a database call or time
# intensive task like calling a third-party API.
self.boardwalk_price += 50
return self.boardwalk_price
```

Now run it:
Expand All @@ -44,19 +44,19 @@ Now run it:
Let's convert the boardwalk property into a `cached_property`.

```python
from cached_property import cached_property
from cached_property import cached_property

class Monopoly(object):
class Monopoly(object):

def __init__(self):
self.boardwalk_price = 500
def __init__(self):
self.boardwalk_price = 500

@cached_property
def boardwalk(self):
# Again, this is a silly example. Don't worry about it, this is
# just an example for clarity.
self.boardwalk_price += 50
return self.boardwalk_price
@cached_property
def boardwalk(self):
# Again, this is a silly example. Don't worry about it, this is
# just an example for clarity.
self.boardwalk_price += 50
return self.boardwalk_price
```

Now when we run it the price stays at $550.
Expand Down

0 comments on commit 4adb332

Please sign in to comment.