You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example I think I would prefer the command line parameter to be named "--no-toggle" and the default to be True if the parameter was not passed. There is a store_false annotation but I don't think it can solve this problem alone (I would have to rename the argument to no_toggle and deal with the consequences in my code).
I hope we could fix this without breaking backwards compatibility. Current code cannot rely on the arg:bool=True to do anything sensible so hopefully everybody avoided using this configuration in existing codebases.
The text was updated successfully, but these errors were encountered:
Example:
Prints:
What I would expect
In this example I think I would prefer the command line parameter to be named "--no-toggle" and the default to be True if the parameter was not passed. There is a
store_false
annotation but I don't think it can solve this problem alone (I would have to rename the argument tono_toggle
and deal with the consequences in my code).This is caused by this line https://github.com/fastai/fastcore/blob/master/fastcore/script.py#L41 always overriding the default value provided by the function definition in case of boolean arguments.
I hope we could fix this without breaking backwards compatibility. Current code cannot rely on the
arg:bool=True
to do anything sensible so hopefully everybody avoided using this configuration in existing codebases.The text was updated successfully, but these errors were encountered: