Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 631507d

Browse files
committed
Issue #11141: Fix the shelve documentation to use a list, not a range object.
Patch by SilentGhost.
1 parent da39790 commit 631507d

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

Doc/ACKS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ [email protected]), and we'll be glad to correct the problem.
182182
* Joakim Sernbrant
183183
* Justin Sheehy
184184
* Charlie Shepherd
185+
* SilentGhost
185186
* Michael Simcich
186187
* Ionel Simionescu
187188
* Michael Sloan

Doc/library/shelve.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ object)::
169169
klist = list(d.keys()) # a list of all existing keys (slow!)
170170

171171
# as d was opened WITHOUT writeback=True, beware:
172-
d['xx'] = range(4) # this works as expected, but...
173-
d['xx'].append(5) # *this doesn't!* -- d['xx'] is STILL range(4)!
172+
d['xx'] = [0, 1, 2] # this works as expected, but...
173+
d['xx'].append(3) # *this doesn't!* -- d['xx'] is STILL [0, 1, 2]!
174174

175175
# having opened d without writeback=True, you need to code carefully:
176176
temp = d['xx'] # extracts the copy

0 commit comments

Comments
 (0)