[issue14149] argparse usage model requires argument names to be python identifiers

2012-02-29 Thread Steven Bethard
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

[issue14149] Argparse usage model requires argument names to be python identifiers

2012-02-28 Thread Joseph Birr-Pixton
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

[issue14149] argparse usage model requires argument names to be python identifiers

2012-02-28 Thread Éric Araujo
É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.