telmich added the comment:
Assuming 3.3.0 behaviour is correct (as in no subparser specified, args.func
not setup), I'd expect to have setup a function on the main parser. Trying
this, it prevents the subparsers function from being completly:
[16:03] brief:~% python3 subparse3.py
main: Namespace(func=<function main at 0x7fdf844b90e0>, x=2, y=1.0)
main: Namespace(func=<function main at 0x7fdf844b90e0>, z='XYZYX')
main: Namespace(func=<function main at 0x7fdf844b90e0>)
Added lines to the original documentation are:
def main(args):
print('main: %s' % args)
...
parser.set_defaults(func=main)
...
args = parser.parse_args('')
args.func(args)
----------
Added file: http://bugs.python.org/file27696/subparse3.py
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16308>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com