-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in do_end_to_end bool argument. Should be action='store_false' #27
Comments
finall stores false:
its using the string False since strings are true:
|
|
if you really want to do it with the original method do
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The issue is due to how the argparse module handles boolean command line arguments. When you pass a string to a boolean argument in argparse (like you are doing in the command line), it doesn't convert 'False' string to a boolean False. In Python, the bool function treats any non-empty string as True.
For boolean arguments, instead of using type=bool in add_argument, a better practice would be to use action='store_true' or action='store_false'.
These will store True if the argument is present and False otherwise (for store_true), or vice versa for store_false. You then use the flag on the command line if you want the value to be True.
For example:
And in the command line, if you want do_end_to_end to be False, you would include the flag:
If you want the default to be False and to set it to True from the command line, use action='store_true' and include the flag when you want it to be True.
This way of handling boolean arguments is generally more intuitive for command-line users.
The text was updated successfully, but these errors were encountered: