[New-bugs-announce] [issue14149] Argparse usage model requires argument names to be python identifiers

Joseph Birr-Pixton report at bugs.python.org
Tue Feb 28 13:23:55 CET 2012


New submission from Joseph Birr-Pixton <jpixton at 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 the argument, but that's not what I want in my help output.

I think it should either:
- Collapse names to valid python identifiers (optparse did this).
- Namespace should act like an object and dict.

----------
components: Library (Lib)
files: argparsetest.py
messages: 154550
nosy: Joseph.Birr-Pixton
priority: normal
severity: normal
status: open
title: Argparse usage model requires argument names to be python identifiers
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file24669/argparsetest.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14149>
_______________________________________


More information about the New-bugs-announce mailing list