Argparse - Checking relation between two variables values

Hi
Can I check the relation between two parameters using argparse?
e.g.

I have min and max parameters.
I want to check that min is smaller than max.

Thx,
Dror

Hi Dror,
you can check relationship between the values after all the arguments were parsed. This approach is independent from argparse. If you encounter a problem I do not see or want something else, please be more specific in describing what is the problem and how the code should behave.

It would be best if you post a functional example of your code and explain how it should behave in specific situations and how the current behaviour differs. Put the code between triple backticks:

``` python
# your code here
```

Hello Dror. Here is an example of picking up two command line values and comparing if the first argument is smaller than the second argument.

Is this what you are looking for?

#Program name is 'prog.py'
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('min', type=int)
parser.add_argument('max', type=int)
args = parser.parse_args()
eval = args.min < args.max
print("min < max :", eval)  #True/False

You use it as…
>>>prog.py 5 9
In this case, it will print True