This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients bethard, docs@python, paul.j3
Date 2014-08-07.23:27:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407454078.51.0.049001386073.issue15428@psf.upfronthosting.co.za>
In-reply-to
Content
On Stackoverflow a couple of posters have asked about nesting namespaces as a way of separating the parser and subparser arguments.

http://stackoverflow.com/questions/15782948
http://stackoverflow.com/questions/18668227

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?
History
Date User Action Args
2014-08-07 23:27:58paul.j3setrecipients: + paul.j3, bethard, docs@python
2014-08-07 23:27:58paul.j3setmessageid: <1407454078.51.0.049001386073.issue15428@psf.upfronthosting.co.za>
2014-08-07 23:27:58paul.j3linkissue15428 messages
2014-08-07 23:27:58paul.j3create