telmich added the comment: Interesting! The issue 9523 has now somehow become obsolete, as in 3.3.0 subcommands are de-facto optional, which is the problem I am facing.
Regarding my last comment, here are the relations: - add a parameter to add_subparsers(): required This is a similar proposal to the original issue 9523, though the other way round: in #9523 the required case was proposed to be the default. As 3.3.0 now defaults to optional, my proposal was to keep this behaviour and allow passing required=True. - Change implementation in such a way that using parser.set_defaults() on the main parser does not affect the sub parsers: As set_defaults() already exists, I think this is the cleaner method to implement this feature instead of using the default='' variant specified in #9523. Besides that I think the current behaviour of set_defaults changing the functions of the sub parsers is definitely a bug on its own. So summarised / compared: - Python 3.3.0 seems to treat subcommands as optional, compared to the original issue 9523 - set_defaults(func=x) on the main parsers affects sub parsers, which renders using set_defaults() useless - If requiring the behaviour of set_defaults() to pass the func= arguments to other parsers, the parents=[] argument already exists - To fix this issue, only correcting the set_defaults() call would be necessary - It makes sense though, to add the 'required' parameter, as the need has also been spotted by others already. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16308> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com