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".

markmacw
  • 186
  • 2
  • 8
  • Because the C version does of the variable does; see http://crasseux.com/books/ctutorial/argc-and-argv.html for an explanation of the naming. – Martijn Pieters Dec 08 '14 at 17:08
  • These date back to `C`, I believe. The `v` in `argv` is for argument 'vector' (and the accompanying `argc` was the argument 'count'). – Cameron Dec 08 '14 at 17:08
  • If my answer fulfill your need, you can accept it, if not, feel free to ask more about it :) – Thomas Ayoub Dec 16 '14 at 08:18
  • Thank you Thomas - this was my first question posted on StackOverflow and I did not realize the check mark was there for the clicking! :) – markmacw Dec 16 '14 at 17:59

1 Answers1

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

Community
  • 1
  • 1
Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142