Why are arguments independent of singular/plural in argparse

Viewed 242

It seems like python script arguments defined with argparse are independent of the form (singular/plural) in which they are provided. Specifically, if one defines a sample script script.py as follows:

import argparse

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--names",
        type=str,
        required=True,
    )

    args, unknown_args = parser.parse_known_args()

    print(vars(args), unknown_args)

When it is called with the below argument, the following is printed

python script.py --name test_name -> {'names': 'test_name'} []

And similarly, when it is called the below argument, the following is printed

python script.py --names test_name -> {'names': 'test_name'} []

Is this an expected behaviour? I could not find anywhere an answer to that question.

0 Answers
Related