Why does argv have a 'v'
Asked Answered
S

1

5

I am studying Python as a novice programmer. I have seen argv, as in sys.argv used and I believe it is used in other languages as well. What is the significance of the 'v' in 'argv'? What does it stand for and where does the term originate?

I am hoping this will help me understand and remember the use of "argv".

Sottish answered 8/12, 2014 at 17:7 Comment(4)
Because the C version does of the variable does; see crasseux.com/books/ctutorial/argc-and-argv.html for an explanation of the naming.Ryter
These date back to C, I believe. The v in argv is for argument 'vector' (and the accompanying argc was the argument 'count').Clearly
If my answer fulfill your need, you can accept it, if not, feel free to ask more about it :)Craggy
Thank you Thomas - this was my first question posted on StackOverflow and I did not realize the check mark was there for the clicking! :)Sottish
C
9

The variables are named argc (argument count) and argv (argument vector) by convention, from C.

note that in Python there's no sys.argc. You just use len(sys.argv) as pointed fred-larson

Craggy answered 8/12, 2014 at 17:8 Comment(1)
Python has no sys.argc, AFAIK. You just use len(sys.argv).Baier

© 2022 - 2024 — McMap. All rights reserved.