I have this code from Learn Python The Hard Way and I need to comment it:
from sys import argv
So I did: #imports argv from the sys module
I know what argv does, but I am having trouble figuring out what to call this element of the sys module? A variable, a method, a function? Argument variable?
Also, given that line of code, does it mean that all the sys module is imported in my program or only argv?
argvis a variable in thesysmodule’s namespace. It happens to be a list.The statement
causes Python to parse the entire
sysmodule (assuming it has not already been parsed, in which case it is not reloaded), and copy theargvvariable into the current module’s namespace.