Skip to content

Commit c5354c0

Browse files
authored
Replace broken example code with correct simpler code. (GH-25162)
The open() was missing 'w' to indicate it was in a write-mode. Even then, the open().close() operation was distracting because it is an unusual way to "touch" as file. Using os.remove() instead is simpler and less distracting.
1 parent e4c8895 commit c5354c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/howto/descriptor.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ different, updated answers each time::
115115
20
116116
>>> g.size # The games directory has three files
117117
3
118-
>>> open('games/newfile').close() # Add a fourth file to the directory
118+
>>> os.remove('games/chess') # Delete a game
119119
>>> g.size # File count is automatically updated
120-
4
120+
2
121121

122122
Besides showing how descriptors can run computations, this example also
123123
reveals the purpose of the parameters to :meth:`__get__`. The *self*

0 commit comments

Comments
 (0)