gh-144338: Improve cmd.Cmd docs for emptyline() and do_EOF#145292
Open
Anandesh-Sharma wants to merge 1 commit intopython:mainfrom
Open
gh-144338: Improve cmd.Cmd docs for emptyline() and do_EOF#145292Anandesh-Sharma wants to merge 1 commit intopython:mainfrom
Anandesh-Sharma wants to merge 1 commit intopython:mainfrom
Conversation
- Document that do_EOF should be defined to handle Ctrl-D gracefully, with a cross-reference to the example - Add a note to emptyline() docs about overriding with pass to suppress the default repeat-last-command behavior - Add emptyline() and do_EOF() to the TurtleShell example to demonstrate these common patterns Closes python#144338 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The following commit authors need to sign the Contributor License Agreement: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #144338 by improving the
cmd.Cmddocumentation to make theemptyline()anddo_EOFpatterns more discoverable:cmdloop()docs thatdo_EOFshould be defined to handle Ctrl-D/EOF gracefully, with a cross-reference to the exampleemptyline()docs about overriding withpassto suppress the default repeat-last-command behavioremptyline()anddo_EOF()methods to the existing TurtleShell example to demonstrate these common patternsThese are the two most commonly needed overrides that new
cmd.Cmdusers struggle to discover from the current documentation.Closes #144338
Test plan
emptyline()anddo_EOF#144338📚 Documentation preview 📚: https://cpython-previews--145292.org.readthedocs.build/