This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Trenton Bricken
Recipients Trenton Bricken, paul.j3, rhettinger, xtreak
Date 2019-12-30.17:28:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577726885.51.0.798739743461.issue39167@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-12-30 17:28:05Trenton Brickensetrecipients: + Trenton Bricken, rhettinger, paul.j3, xtreak
2019-12-30 17:28:05Trenton Brickensetmessageid: <1577726885.51.0.798739743461.issue39167@roundup.psfhosted.org>
2019-12-30 17:28:05Trenton Brickenlinkissue39167 messages
2019-12-30 17:28:05Trenton Brickencreate