Skip to content

Instantly share code, notes, and snippets.

@lesserfish
Created September 2, 2025 08:05
Show Gist options
  • Select an option

  • Save lesserfish/0a6849b52d6ef47d45c5199edd189822 to your computer and use it in GitHub Desktop.

Select an option

Save lesserfish/0a6849b52d6ef47d45c5199edd189822 to your computer and use it in GitHub Desktop.
Example of mutual exclusive groups in argparse
resample_group = parser.add_mutually_exclusive_group()
resample_group.add_argument("--resampling", dest="resampling", action="store_true",
help="Enable resampling (default).")
resample_group.add_argument("--no-resampling", dest="resampling", action="store_false",
help="Disable resampling.")
parser.set_defaults(resampling=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment