GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add a tutorial for cmd.Cmd for `emptyline()` and `do_EOF` · Issue #144338 · python/cpython

Add a tutorial for cmd.Cmd for emptyline() and do_EOF #144338

New issue
Copy link
New issue
Copy link
Open
Open
Add a tutorial for cmd.Cmd for emptyline() and do_EOF#144338
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.

Description

@pythonhacker
pythonhacker
opened on Jan 30, 2026
Issue body actions

Documentation

This is w.r.t the issue #143804

It was pointed out it is not a bug (agreed) but we can improve the documentation of this module
since it is now not very clear that

  • One has to over-ride "emptyline" so that the last line is not repeated
  • One has to over-ride do_EOF to quit cleanly

A tutorial on this in the documentation would be helpful as right now these are at the level of method level documentation and quite unclear at the usage level.

Linked PRs

  • gh-144338: Improve cmd.Cmd docs for emptyline() and do_EOF #145292

Activity

  1. pythonhacker
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Jan 30, 2026
  2. github-project-automation
    added this to docs issueson Jan 30, 2026
  3. github-project-automation
    moved this to Todo in docs issueson Jan 30, 2026
  4. picnixz
    added
    triagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.
    on Jan 30, 2026
  5. sabasiddique1 commented on Jan 30, 2026

    @sabasiddique1
    sabasiddique1
    on Jan 30, 2026
    More actions

    I’d like to work on #144338. I can add a short example in cmd docs showing how to override emptyline() and do_EOF() for shells that use default().

    Reacted by Anand B Pillai and An Long
  6. picnixz
    changed the title [-]Modify documentation of cmd.Cmd to indicate subtle behaviours[/-] [+]Add a tutorial for cmd.Cmd[/+] on Feb 1, 2026
  7. picnixz commented on Feb 1, 2026

    @picnixz
    picnixz
    on Feb 1, 2026
    Member
    More actions

    For this issue I do not want the current documentation to be altered in any way. I only want a HOWTO/Tutorial/cookbook for this module, like we have for logging or Enum so please:

    • Do not use AI for generating your content. If I ever see an AI-generated PR I will close the PR without reviewing it.
    • Take inspiration from our existing guides. We have a page that contains all existing tutorials I think so you should take a look at it.
    Reacted by Tan Long and Saba Siddique
  8. Divyanshudevtalla commented on Feb 3, 2026

    @Divyanshudevtalla
    Divyanshudevtalla
    on Feb 3, 2026 · Hidden as spam
    show commentMore actions
  9. Divyanshudevtalla commented on Feb 3, 2026

    @Divyanshudevtalla
    Divyanshudevtalla
    on Feb 3, 2026 · Hidden as spam
    show commentMore actions
  10. picnixz commented on Feb 3, 2026

    @picnixz
    picnixz
    on Feb 3, 2026
    Member
    More actions

    @Divyanshudevtalla I clearly said what needs to be done. If you used an LLM for your answer but did not review its content, stop it. I am tired of low-quality comments that do not add anything valuable to the discussion. Should it happen again, restrictive measures will be taken.

  11. sabasiddique1 commented on Feb 3, 2026

    @sabasiddique1
    sabasiddique1
    on Feb 3, 2026
    More actions

    I’d be happy to work on this if it’s not already assigned.

    I’m planning to add a small HOWTO for the cmd module, with a minimal example that:

    • explains the default empty‑line behavior, and
    • shows how to override emptyline() and implement do_EOF().

    Please let me know if this approach sounds good.

  12. picnixz commented on Feb 3, 2026

    @picnixz
    picnixz
    on Feb 3, 2026
    Member
    More actions

    As long as you do not use an LLM for this task, I would be happy with this addition. However, I want you to have a look at https://docs.python.org/3/howto/index.html. For instance, I would assume that the tutorial on using cmd.Cmd may fall under the same category as for ipaddress but we can also add a section directly at the end of the cmd module, following the simple example https://docs.python.org/3/library/cmd.html#cmd-example, that is, we can just add an example for this empty line behavior.

    I think the second option is better as for now, only this specific behavior was a bit confusing to users. Having a full-fledged tutorial may seem an overkill for now.

  13. rhettinger commented on Feb 4, 2026

    @rhettinger
    rhettinger
    on Feb 4, 2026
    Contributor
    More actions

    ISTM that cmd already has a thorough well motivated example sufficient to teach someone how to use it:

    https://docs.python.org/3/library/cmd.html#cmd-example

  14. picnixz
    changed the title [-]Add a tutorial for cmd.Cmd[/-] [+]Add a tutorial for cmd.Cmd for `emptyline()` and `do_EOF`[/+] on Feb 4, 2026
  15. picnixz commented on Feb 4, 2026

    @picnixz
    picnixz
    on Feb 4, 2026
    Member
    More actions

    Yeah but that example does not cover this specific issue. So I'm fine with adding another example for emptyline() and do_EOF.

    Note: do_EOF does not seem to be documented either (but I'm not sure that the hook is a hook then)

    Reacted by Anand B Pillai
  16. Anandesh-Sharma
    added a commit that references this issue on Feb 26, 2026

    pythongh-144338: Improve cmd.Cmd docs for emptyline() and do_EOF

    f9602fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc dirtriagedThe issue has been accepted as valid by a triager.The issue has been accepted as valid by a triager.

    Projects

    • docs issues
      Status
      Todo
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.