[issue39167] argparse boolean type bug

2019-12-31 Thread Trenton Bricken
Trenton Bricken added the comment: Thanks for all of these replies. The functionality is that the user adds --flag True False and then all of the other parameters are run with True. And then again with False. I thought this was a bug because of the confusing type=bool behavior

[issue39167] argparse boolean type bug

2019-12-30 Thread Trenton Bricken
New submission from Trenton Bricken : This is a bug with argparse. Say I have: parser.add_argument('--verbose', type=bool, action='store', nargs='+', default = [False], help='turns on verbosity') If in the command line I have "--verbose

[issue39167] argparse boolean type bug

2019-12-30 Thread Trenton Bricken
Trenton Bricken added the comment: Update: I was being dumb before, the problem still remains but my work around previously was wrong. This is the new workaround: def buildBool(arg): if arg == 'False': return False else: return True

[issue39167] argparse boolean type bug

2019-12-30 Thread Trenton Bricken
Trenton Bricken added the comment: Thank you for your quick and helpful reply. The problem with your solution is twofold: 1. it adds some cognitive load in needing to remember whether or not the flag defaults to True or False and thus whether or not you need to add it. It is easier for me