Message225046
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? |
|
Date |
User |
Action |
Args |
2014-08-07 23:27:58 | paul.j3 | set | recipients:
+ paul.j3, bethard, docs@python |
2014-08-07 23:27:58 | paul.j3 | set | messageid: <1407454078.51.0.049001386073.issue15428@psf.upfronthosting.co.za> |
2014-08-07 23:27:58 | paul.j3 | link | issue15428 messages |
2014-08-07 23:27:58 | paul.j3 | create | |
|