Steven Bethard steven.beth...@gmail.com added the comment:
For optional flags like --foo-bar, argparse does munge the dest to foo_bar,
following optparse. For positional arguments, arpgarse doesn't munge things
this way, but if you want the argument named foo-bar in help messages and
foo_bar
New submission from Joseph Birr-Pixton jpix...@gmail.com:
Say I have an argument with the name 'foo-bar'. Argparse accepts and parses
arguments, but Namespace does not allow me to access the value.
Yes, I can use getattr or Namespace.__dict__. But that's ugly.
Yes, I can change the name of
Éric Araujo mer...@netwok.org added the comment:
If argparse munged foo-bar to foo_bar to allow attribute access, then it’d need
to disallow ambiguous cases like add_argument('foo_bar', ...);
add_argument('foo-bar', ...). I’m not sure if there is real, sensible code
that does that, though.