Add parameter `validator` to `argparse.ArgumentParser.add_argument` or enhance `argparse` docs
Discussions on Python.org
Add parameter `validator` to `argparse.ArgumentParser.add_argument` or enhance `argparse` docs
Note I made this proposal first as this issue, which was obviously the wrong way to go. Sorry for the extra noise. Problem Often only certain values are allowed for command line argument values. For example, you may have an argument of type int that has to be positive, but setting type=int in argparse.ArgumentParser.add_argument allows also for negative values. So even in such a simple case you have to implement your own validator rejecting negative values. It would be nice to have an easy way...
0 comments
No comments yet.