Looking at the previous question, I would say that what you are really looking for is a way to assign a default value to a missing parameter using argparse . In this case, you should simply use default as follows:
parser.add_argument('-o', '--only', default=default_servers, ...)
Thus, when the -o/--only option -o/--only not passed, the namespace will be set correctly by default.
source share