Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
bpo-37564: ArgumentParser support bool type according to truth values #14709
Hello, and thanks for your contribution!
I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).
Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.
You can check yourself to see if the CLA has been received.
Thanks again for your contribution, we look forward to reviewing it!
Telling this developer that 'type' parameter is anything else then the object-type of the retrieved argument value from the user is not intuitive, and misleading.
It is agreed that the 'type' parameter is supposed to be callable. This is to allow a user to provide custom conversion functions for his/her special needs. But when it comes to primitive types such as int, str, float, and bool - the 'type' parameter should simply define the type of which the value will be received from the (humane) user.
No humane user will think to provide an empty string to express Falae, or to provide the string 'False' in order to express True.
Regarding the qualms that you have raised about the proposed solution:
I also agree that this solution might break a consistent behavior, although I don't see any reason why someone will have in his/her legacy code type=bool, while it is obviously not serving their needs.