'What is the exact term for 'argv' in python?

I am currently trying to grasp the exact name of argv function (if it can be called a function) that can be imported from sys or system-specific parameters. I found 3 definitions:

So which one is it? Perhaps it doesn't matter how one calls it? Does it even have an accepted name?

Thanks everyone!



Solution 1:[1]

It doesn't really matter. It's a list (not a function), and the name argv is just borrowed from the conventional name used in C. Most of the time, you are better off using a library like argparse to process the command line arguments, in which case you won't even be using sys.argv directly.

Solution 2:[2]

argv is a variable (a list of arguments), and is therefore not a function.

The naming seems to come from conventions used in C, which uses argc (argument count) and argv (argument vector). See also https://stackoverflow.com/a/3024202/693140

Solution 3:[3]

None of these 3 are satisfying, because 1) this is a list and 2) "argument" is vague and misleading (these are actually "command line arguments")

A better term is "list of command line arguments".

From the documentation:

sys.argv

The list of command line arguments passed to a Python script. argv[0] is the script name (it is operating system dependent whether this is a full pathname or not). If the command was executed using the -c command line option to the interpreter, argv[0] is set to the string '-c'. If no script name was passed to the Python interpreter, argv[0] is the empty string.

To loop over the standard input, or the list of files given on the command line, see the fileinput module.

PS: this is a bit pedantic, and people will generally understand what you're talking about when they see sys.argv, regardless of what term you chose to call it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 chepner
Solution 2 Stefan Kögl
Solution 3 DevShark