mirror of
https://github.com/python/cpython.git
synced 2025-11-22 11:36:23 +00:00
Issue #12713: reverted fix pending further discussion.
This commit is contained in:
parent
d1c2a8e2b5
commit
9ae505041f
4 changed files with 32 additions and 98 deletions
|
|
@ -1668,18 +1668,6 @@ Sub-commands
|
|||
>>> parser.parse_args(['co', 'bar'])
|
||||
Namespace(foo='bar')
|
||||
|
||||
argparse supports non-ambiguous abbreviations of subparser names.
|
||||
|
||||
For example, the following three calls are all supported
|
||||
and do the same thing, as the abbreviations used are not ambiguous::
|
||||
|
||||
>>> parser.parse_args(['checkout', 'bar'])
|
||||
Namespace(foo='bar')
|
||||
>>> parser.parse_args(['check', 'bar'])
|
||||
Namespace(foo='bar')
|
||||
>>> parser.parse_args(['che', 'bar'])
|
||||
Namespace(foo='bar')
|
||||
|
||||
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. For
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue