[issue15428] add Name Collision section to argparse docs

2014-08-07 Thread paul j3

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.

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?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15428
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15428] add Name Collision section to argparse docs

2014-08-03 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
type:  - enhancement
versions: +Python 3.5 -Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15428
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15428] add Name Collision section to argparse docs

2013-08-14 Thread paul j3

Changes by paul j3 ajipa...@gmail.com:


--
nosy: +paul.j3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15428] add Name Collision section to argparse docs

2012-07-22 Thread Steven Bethard

New submission from Steven Bethard steven.beth...@gmail.com:

Several bugs (e.g. Issue 15327 and Issue 15271) have been filed suggesting that 
people aren't really clear on how argparse handles argument name collisions or 
how they can get it to do what they want.

I think these problems could probably be solved by a Name Collision section 
(or something like that) in the argparse documentation. It would give a few 
example problems and show how to resolve them. Some things to include:

* What happens when two arguments have the same dest (Issue 15271), with 
solutions including action='append' or different dest= values combined with 
identical metavar= values.

* What happens when a parser and a sub-parser share some of the same argument 
names (Issue 15327), with solutions including specifying different dest= values 
for the parser and sub-parser

* A brief mention and cross-reference to the conflict_handler section.

--
assignee: docs@python
components: Documentation
messages: 166185
nosy: bethard, docs@python
priority: normal
severity: normal
status: open
title: add Name Collision section to argparse docs
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com