Learning Modules, Arguments, Parameters (imma noob)

Terry Reedy tjreedy at udel.edu
Fri Sep 25 20:08:01 EDT 2015


On 9/25/2015 2:50 PM, Cody Cox wrote:
> Awesome guys! Thank you for helping me understand this material.
> Parameters and Arguments are tricky. Looks like its mainly a game of
> connect the dots with variables. lol.

If you stick with the convention that parameters are names in the header 
of a function definition, arguments are objects in a function call, and 
calls bind parameter names to argements (or sometimes collected 
arguments), then it is not so tricky.  But also remember that not 
everyone follows this convention, or even any consistent usage.

To reiterate about calling and binding.

def f(x): pass
f(2)

binds the name 'x' to the int object with value 2.  This is essentially 
the same as 'x = 2', except that the binding takes place in the local 
namespace of the function rather than in the local namespace of the call.


-- 
Terry Jan Reedy




More information about the Python-list mailing list