Skip to content

Add warning callout re: bool and store_true defaults#676

Merged
jph00 merged 2 commits into
mainfrom
bool_type_warn
Mar 31, 2025
Merged

Add warning callout re: bool and store_true defaults#676
jph00 merged 2 commits into
mainfrom
bool_type_warn

Conversation

@johnowhitaker
Copy link
Copy Markdown
Contributor

Using bool arg with default True results in the default getting over-written (see e.g. #533) which has confused a few people. This PR adds a small warning to the docs to use bool_arg instead.

@johnowhitaker
Copy link
Copy Markdown
Contributor Author

@jph00 it's a small thing but I've made this mistake in the past (setting my_param:bool=True not realizing it will still default to False). This PR adds a small callout to the docs with a warning to use bool_arg instead of bool in this case.
Demo of what I'm talking about: https://gist.github.com/johnowhitaker/52ae8cbeddaf43a62d345253f515ac97

@jph00 jph00 merged commit 6c4c2f5 into main Mar 31, 2025
14 checks passed
@jph00
Copy link
Copy Markdown
Contributor

jph00 commented Mar 31, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants