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

2019-10-31 Thread paul j3
paul j3 added the comment: Just clarify how the code currently works. `subparsers` is a positional Action of subclass _SubParsersAction. It has a nargs='+...', requiring at least one string, and taking all remaining strings. Its __call__ has the standard signature. So everything that's s

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

2019-10-31 Thread Dávid Nemeskey
Dávid Nemeskey added the comment: I ran into the same problem. I know of the set_defaults() method, in fact, that is what I have always been using. But why was dest added if not to provide a better solution? I agree that changing it would _perhaps_ break some code, so I agree that this issue

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

2019-04-20 Thread paul j3
paul j3 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 uniqu

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

2019-04-18 Thread paul j3
paul j3 added the comment: I added a `print(args)` to clarify what you are talking about: 2148:~/mypy$ python3 issue36664.py subsection Namespace(context='subsection') my subsection was called 2148:~/mypy$ python3 issue36664.py s Namespace(context='s') my functon was not called 2148:~/mypy$ p

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

2019-04-18 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +paul.j3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

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

2019-04-18 Thread Peter McEldowney
New submission from Peter McEldowney : I noticed that I have to add a lot more code to handle contexts in subparsers that I was expecting would be necessary. This is something I feel should be handled by the argparse library. What are your thoughts on this? If you run the sample code with th