Skip to content

Commit

Permalink
Tweak the storage docs slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
lordmauve committed May 8, 2019
1 parent b2be788 commit 1496b82
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/builtins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,8 @@ saved as JSON_, which means you can only store certain types of objects in it:
The ``storage`` for a game is initially empty. Your code will need to handle
the case that values are loaded as well as the case that no values are found.

A tip is to use ``setdefault()``, which inserts a default if there is none::
A tip is to use ``setdefault()``, which inserts a default if there is no value for
the key, but does nothing if there is::

storage.setdefault('highscore', 0)

Expand Down

0 comments on commit 1496b82

Please sign in to comment.