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 paul.j3
Recipients josh.r, krichter, paul.j3, r.david.murray
Date 2014-05-28.03:55:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1401249333.63.0.883310305185.issue21208@psf.upfronthosting.co.za>
In-reply-to
Content
Last year someone asked on Stackoverflow about using 'type=bool'.  My answer is at:

http://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse/19233287#19233287

'type' is supposed to be a function that takes a string, and converts to a desired Python object (e.g. number), and in the process validates it.

The builtin 'bool()' is not a good choice for this. 'bool("")' returns False, all other strings return True, that includes strings like "false", "no", "False".  If you want those strings to be interpreted as boolean False, you need to write your own 'str2bool' function.

But normally boolean values are entered via 'store_true' and 'store_false' actions.
History
Date User Action Args
2014-05-28 03:55:34paul.j3setrecipients: + paul.j3, r.david.murray, krichter, josh.r
2014-05-28 03:55:33paul.j3setmessageid: <1401249333.63.0.883310305185.issue21208@psf.upfronthosting.co.za>
2014-05-28 03:55:33paul.j3linkissue21208 messages
2014-05-28 03:55:31paul.j3create