Trenton Bricken <brickentren...@gmail.com> 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 to have everything as a flag with a value that follows. 
2. More importantly, I am using argparse for trying lots of different 
combinations of inputs to a function so I pass them in as a list and then 
permute the possible values for each input. 

For example: --flag1 a b
--flag2 c d
 
I want to then run a command with the parameter combinations: 
a, c; a, d; b, c; b, d;

And I don't think store_true store_false would allow me to pass in having 
combinations of True and False like --flag True False would. 

I am fine now with my current work around, but was very confused for some time 
why my flag would be true when I set it to false. And think this is a 
counterintuitive pitfall other developers can fall into.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39167>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to