[issue36664] argparse: parser aliases in subparsers stores alias in dest variable

paul j3 report at bugs.python.org
Sat Apr 20 23:29:55 EDT 2019


paul j3 <ajipanca at gmail.com> added the comment:

https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_subparsers

shows how to use `set_defaults` in a parser to set a 'func' attribute.  That method could just as well be used to set the true 'name' or any other kind of attribute that is unique to that parser.  

I think we should leave the code as is, storing the aliases in the subparsers' 'dest'.  It's been that way since aliases were added, and changing it runs the risk of creating backward compatibility issues.  

There are enough work arounds if you don't want the aliases.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36664>
_______________________________________


More information about the Python-bugs-list mailing list