paul j3 added the comment:

I've posted a file that runs your code as you expect.

It uses a custom Action class (like your test case).  It subclasses 
._SubParsersAction, and replaces the 9351 namespace use with the original one.  
I use the registry to change the class that parser.add_subparsers() uses.

The stock argparse.py file does not need to be changed.

ps

In your custom Action I access `namespace.foo` with `getattr(namespace, 'foo', 
None)` which is how argparse accesses the namespace, and does not throw 
attribute errors.

----------
Added file: http://bugs.python.org/file44363/issue27859test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27859>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to