Skip to content

Commit ef087b9

Browse files
committed
Improve memoize docs
1 parent 47fc277 commit ef087b9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/tutorial.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ a one second timeout. Operations will attempt to abort if they take longer than
372372
one second. The remaining API of :class:`FanoutCache <diskcache.FanoutCache>`
373373
matches :class:`Cache <diskcache.Cache>` as described above.
374374

375-
:class:`FanoutCache <diskcache.FanoutCache>` adds an additional feature:
376-
:meth:`memoizing <diskcache.FanoutCache.memoize>` cache decorator. The
377-
decorator wraps a callable and caches arguments and return values.
375+
Caches have an additional feature: :meth:`memoizing
376+
<diskcache.FanoutCache.memoize>` decorator. The decorator wraps a callable and
377+
caches arguments and return values.
378378

379379
>>> from diskcache import FanoutCache
380380
>>> cache = FanoutCache()
@@ -386,14 +386,14 @@ decorator wraps a callable and caches arguments and return values.
386386
... return 1
387387
... else:
388388
... return fibonacci(number - 1) + fibonacci(number - 2)
389-
>>> print(sum(fibonacci(number=value) for value in range(100)))
389+
>>> print(sum(fibonacci(value) for value in range(100)))
390390
573147844013817084100
391391

392392
The arguments to memoize are like those for `functools.lru_cache
393393
<https://docs.python.org/3/library/functools.html#functools.lru_cache>`_ and
394-
:meth:`FanoutCache.set <diskcache.FanoutCache.set>`. Remember to call
395-
:meth:`memoize <diskcache.FanoutCache.memoize>` when decorating a callable. If
396-
you forget, then a TypeError will occur.
394+
:meth:`Cache.set <.Cache.set>`. Remember to call :meth:`memoize
395+
<.FanoutCache.memoize>` when decorating a callable. If you forget, then a
396+
TypeError will occur::
397397

398398
>>> @cache.memoize
399399
... def test():
@@ -403,7 +403,7 @@ you forget, then a TypeError will occur.
403403
TypeError: name cannot be callable
404404

405405
Observe the lack of parenthenses after :meth:`memoize
406-
<diskcache.FanoutCache.set>` above.
406+
<diskcache.FanoutCache.memoize>` above.
407407

408408
.. _`Sharding`: https://en.wikipedia.org/wiki/Shard_(database_architecture)
409409

0 commit comments

Comments
 (0)