On the "def" line of a function definition, all you're doing it saying 1) what it will look like when your function is called (its name, how many arguments, etc) and 2) what the names of the arguments will be when you want to refer to them inside your function.
For example:
Code:
def myFunction(arg, another_arg):
What you're saying here is that you will make a function, called "myFunction," and it will have two arguments. Inside your function, you'll call the first argument "arg," and the second one "another_arg". You can't do something like:
Code:
def myFunction(arg.something, another_arg.something_else):
because you're trying to do something with your arguments, not just give them names. You can do whatever you want inside the function, though:
Code:
def myFunction(arg, another_arg):
if arg.something == another_arg.something_else:
print "You're right!"
return True
else:
print "You're wrong!"
return False
Bookmarks