[issue43220] Explicit default required arguments with add_mutually_exclusive_group are rejected

2021-02-14 Thread Keith Smiley
Keith Smiley added the comment: Here's an example outside of argparse showing this is caused by the `is` comparison with interned string: ``` import sys short_string = sys.argv[1] short_default = '1' long_string = sys.argv[2] long_default = 'not-interned' print(f"short comparisons: id1: {id

[issue43220] Explicit default required arguments with add_mutually_exclusive_group are rejected

2021-02-13 Thread Keith Smiley
Change by Keith Smiley : -- keywords: +patch pull_requests: +23311 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24526 ___ Python tracker ___ ___

[issue43220] Explicit default required arguments with add_mutually_exclusive_group are rejected

2021-02-13 Thread Keith Smiley
New submission from Keith Smiley : With this code: ``` import argparse parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group(required=True) group.add_argument("--foo", default="1") group.add_argument("--bar") args = parser.parse_args() print(args) ``` When you explici