[docs] [issue15428] add "Name Collision" section to argparse docs

paul j3 report at bugs.python.org
Fri Aug 8 01:27:58 CEST 2014

paul j3 added the comment:

On Stackoverflow a couple of posters have asked about nesting namespaces as a way of separating the parser and subparser arguments.


One solution that I rather like http://stackoverflow.com/a/18709860/901925

uses a custom Namespace class that recognizes a 'dest' like

    p.add_argument('--deep', dest='test.doo.deep')

and produces

    Nestedspace(foo='test', test=Nestedspace(bar='baz', doo=Nestedspace(deep='doodod')))

I wonder if a simplified version of this could be added to the Namespace section in the documentation.

There are 2 sides to the name conflict issue:

- what control does the programmer have over names (esp. when using [parents] and subparsers)?

- how does the programmer want to access the arguments in the resulting namespace?


Python tracker <report at bugs.python.org>

More information about the docs mailing list