Skip to content

Commit

Permalink
Replace broken example code with correct simpler code. (GH-25162)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rhettinger committed Apr 3, 2021
1 parent e4c8895 commit c5354c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ different, updated answers each time::
20
>>> g.size # The games directory has three files
3
>>> open('games/newfile').close() # Add a fourth file to the directory
>>> os.remove('games/chess') # Delete a game
>>> g.size # File count is automatically updated
4
2

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

0 comments on commit c5354c0

Please sign in to comment.