[issue45580] argparse.ArgumentParser.add_mutually_exclusive_group : metavar create parenthesis undefined behavior

2021-10-25 Thread paul j3
paul j3 added the comment: The usage formatting is fragile, with many associated bug reports. Until someone does a major rewrite, it is best to avoid special characters, especially `()` and `[]` in the `dest` or `metavar`. Usage uses () to encolde mutually_exclusive_groups and [] to mark

[issue45580] argparse.ArgumentParser.add_mutually_exclusive_group : metavar create parenthesis undefined behavior

2021-10-23 Thread Nikita Sobolev
Nikita Sobolev added the comment: Maybe instead we can show users something like: ``` usage: ex.py [-h] (-p '/var/www/html' | -r 'http)s(://Host:Port') [--last-args LAST_ARGS] ``` ? -- components: +Library (Lib) -Parser type: -> behavior versions: +Python 3.10, Python 3.11

[issue45580] argparse.ArgumentParser.add_mutually_exclusive_group : metavar create parenthesis undefined behavior

2021-10-23 Thread Nikita Sobolev
Nikita Sobolev added the comment: I confirm this happens on all recent Python versions. The source of this problem is that `argparse` uses `regex` module to replace some substrings. Direct link:

[issue45580] argparse.ArgumentParser.add_mutually_exclusive_group : metavar create parenthesis undefined behavior

2021-10-22 Thread AbcSxyZ
New submission from AbcSxyZ : Hi, I'm getting a kind of undefined behavior where parenthesis seem handled in a strange way. On display, it has a conflict between parenthesis of the option, and nested parenthesis within a metavar. ## Reproduction script ``` import argparse def main():