Skip to main content

Foundations of Python Programming: Functions First

Section 4.13 Glossary

Glossary Glossary

abstraction.
A common computer programming approach and problem solving technique where, in order to make the algorithm less complex easier to understand, the various sub-steps to the solution are ’hidden’ within a named object (like a function) - the abstraction. Then to solve a problem the the programmer refers to this and other abstractions without having conceptualize their inner workings.
argument.
A value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function. The argument can be the result of an expression which may involve operators, operands and calls to other fruitful functions. Also called actual parameters or parameter values.
body.
The second part of a compound statement. The body consists of a sequence of statements all indented the same amount from the beginning of the header. The standard amount of indentation used within the Python community is 4 spaces.
compound statement.
A statement that consists of two parts:
  1. header - which begins with a keyword determining the statement type, and ends with a colon.
  2. body - containing one or more statements indented the same amount from the header.
The syntax of a compound statement looks like this:
keyword expression:
    statement
    statement
    ...
decomposition.
A computer science problem solving technique where a complex problem is broken into simpler (more easily solved) sub-parts who’s solutions are often coded for separately (often with functions). Also known as factoring, decomposed programs are easier to design, understand, code, and maintain.
docstring.
Triple-quoted string, placed as the first line(s) of a function, that documents the function as its __doc__ attribute.
flow of execution.
The order in which statements are executed during a program run.
function.
A named sequence of statements that performs a specific operation. Specific functions can then be used (repeatedly and in conjuction with other functions) to solve more complicated problems. Functions may or may not take parameters and may or may not produce a result.
function call.
Also known as a function invocation. A statement that executes a function. It consists of the name of the function followed by a list of arguments enclosed in parentheses.
function composition.
Using the output from one function call as the input to another.
function definition.
A statement that creates a new function, specifying its name, parameters, and the statements it executes.
fruitful function.
A function that returns a value when it is called.
global variable.
A variable defined at the top level, not inside any function.
header line.
The first part of a compound statement. A header line begins with a keyword and ends with a colon (:)
lifetime.
Variables and objects have lifetimes — they are created at some point during program execution, and will be destroyed at some time. In python, objects live as long as there is some variable pointing to it, or it is part of some other compound object, like a list or a dictionary. In python, local variables live only until the function finishes execution.
local variable.
A variable defined inside a function. A local variable can only be used inside its function.It’s scope means it only exists while the function’s code is being executed. Trying to access (to display or for later processing) a local variable outside of, or after a function will produce a runtime error - NameError: variable name is not defined. Parameters of a function are also a special kind of local variable.
non-fruitful (void) function.
A function that does not return a value upon invocation. In some languages, this kind of function is called a procedure.
None.
A special Python value. One use in Python is that it is returned by functions that do not execute a return statement with a return argument.
parameter.
A name used inside a function to refer to the value which was passed to it as an argument.
parameter list.
Also, formal parameters, ideal parameters, or parameter names, the ordered names of the parameters listed in the function definition.
return.
The keyword or a statement, optionally followed by a value, ends a function call and provides a return value from the function to the caller.
return value.
The value provided as the result of a function call.
scope.
A description of where an identified item (a variable, a function etc.) is recognized and accessible: where in a program is that item valid to be used. For example, a function can only be called after it has been defined. A parameter within a function can only be accessed by instructions within the function.
side effect.
Some lasting effect of a function call, other than its return value. Side effects include print statements, changes to mutable objects, and changes to the values of global variables.
stack frame.
A frame that keeps track of the values of local variables during a function execution (within the scope of the function), and where (what scope) to return control to when the function execution completes.
type annotation.
An optional notation that specifies the type of a function parameter or function result.
You have attempted of activities on this page.