◐ Shell
clean mode source ↗

gh-99735: Handle no arguments when using sub-commands in argparse by ppaez · Pull Request #99736 · python/cpython

slateny

Comment on lines +1855 to +1858

One particularly effective way of handling sub-commands is to
combine the use of the :meth:`add_subparsers` method with calls to
:meth:`set_defaults` so that each subparser knows which Python
function it should execute. The :meth:`set_defaults` method of the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend keeping the original structure so just the new changes can be more easily reviewed.

One particularly effective way of handling sub-commands is to
combine the use of the :meth:`add_subparsers` method with calls to
:meth:`set_defaults` so that each subparser knows which Python
function it should execute. The :meth:`set_defaults` method of the
One particularly effective way of handling sub-commands is to combine the use
of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so
that each subparser knows which Python function it should execute.
The :meth:`set_defaults` method of the
combine the use of the :meth:`add_subparsers` method with calls to
:meth:`set_defaults` so that each subparser knows which Python
function it should execute. The :meth:`set_defaults` method of the
main parser is called to handle the case when no subcommand is

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny nit, since 'sub-command' was used above in the same paragraph

main parser is called to handle the case when no subcommand is
main parser is called to handle the case when no sub-command is