[issue42258] argparse: show choices once per argument

2020-11-11 Thread mendelmaleh


mendelmaleh  added the comment:

When using more than one flag for an argument, it is redundant to have the 
choices more than once, since they are the same argument and have the same 
choices.
Showing it once means cleaner output, and often means that the other option 
lines are shorter, like in the test case.

### sample code
```py
import argparse

ap = argparse.ArgumentParser(allow_abbrev=False)
ap.add_argument('-c', '--choices', choices=['a', 'b', 'c'])
ap.parse_args()
```

### previous output
```
usage: main.py [-h] [-c {a,b,c}]

optional arguments:
  -h, --helpshow this help message and exit
  -c {a,b,c}, --choices {a,b,c}
```

### new output
```
usage: main.py [-h] [-c {a,b,c}]

optional arguments:
  -h, --helpshow this help message and exit
  -c, --choices {a,b,c}
```

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42258] argparse: show choices once per argument

2020-11-07 Thread hai shi


New submission from hai shi :

I like your improvement.
But I suggest you should copy your first comment from your PR to here.(It's 
easy for discuss in here;)

--
nosy: +paul.j3, rhettinger, shihai1991

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42258] argparse: show choices once per argument

2020-11-04 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +22056
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23143

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42258] argparse: show choices once per argument

2020-11-04 Thread mendelmaleh


Change by mendelmaleh :


--
components: Library (Lib)
nosy: mendelmaleh
priority: normal
severity: normal
status: open
title: argparse: show choices once per argument
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com