Skip to content

Commit 8d950e5

Browse files
committed
Use reference in with-statement
1 parent 935cc39 commit 8d950e5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

docs/tutorial.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,13 @@ in a `with` statement to safeguard calling :meth:`close
8686

8787
>>> cache.close()
8888
>>> with Cache(cache.directory) as reference:
89-
... pass
89+
... reference.set('key', 'value')
90+
True
9091

9192
Closed Cache objects will automatically re-open when accessed. But opening
9293
Cache objects is relatively slow, and since all operations are atomic, may be
9394
safely left open.
9495

95-
>>> cache.set('key', 'value')
96-
True
9796
>>> cache.close()
9897
>>> cache.get('key') # Automatically opens, but slower.
9998
'value'

0 commit comments

Comments
 (0)