Skip to main content

Glossary



.

... - The default Python prompt of the interactive shell when a block of code hasn't been closed yet (eg. before brackets are closed or if you are writing an indented block of code). In IDLE, you don't have the three dots, only spaces.


>

>>> - The default Python prompt of the interactive shell. It is used before code examples in this course. The prompt looks different if you use a different interactive shell such as iPython.


A

Append - Add an element to the end of a sequence or some text to the end of a file.

Arguments - Values input to a function (For example, arg1 and arg2 in this case: my_function(arg1,arg2): …). There are several types of arguments including positional, keyword and arguments.

Array (NumPy Arrays) - An object type defined in the NumPy package, similar to the definition of a Fortran array. Arrays are similar to Python lists, but allow flexible and powerful processing of multi-dimensional datasets.

Assignment - A statement which sets of re-sets the value associated with a variable name. For example: x=34.5 assigns the value 34.5 to the variable x.

Attribute - A value associated with an object, but not the object itself. It is referenced using the dot expression. For example, myarray.size is the attribute size of the object myarray. It will be a integer.


B

Basemap - A python package used with matplotlib to create maps.

Boolean - A type of data that can take two values True or False. Booleans are capitalised. Comparisons , with >,< or ==, return Boolean values True or False.

Built-in - Describes a type or function available with the standard installation of Python. Buit-in functions include help() and type().


C

Canopy - A python distribution which facilitates the installation of Python for scientific users and comes with hundreds of packages.

Code (Source Code) - collection of computing instructions in a programming language. It can be part of a program or written directly in the Python interpreter.

Command - Generally a way to interact with a program or shell to control its actions. In this course it is sometimes used to mean ‘a line of code’ or a ‘statement’.

Comment - A line of code that is not executed by the interpreter, used to document a program. It is either preceded by a hashtag (#) or enclosed within triple double quotes (“””Description of the program“””)

Compilation - A step used to produce an executable from the source code. This step is necessary to run code written in compiled languages like Fortran. This step is not necessary to run Python code, instead you need to use an interpreter.

Complex Number - A type of number composed of a real part and an imaginary part represented with a j (eg. 3+5j).

Concatenate - To stick two sequences together one after the other. In python, you can do this with the operator +.


D

Dictionary - A type of data described as a mapping. It contains multiple elements with values associated with keys rather than their position in a sequence. Dictionaries are mutable, they can be modified. Dictionaries are denoted with curly brackets {}. Example: mydict={‘key1’:1.0,’key2’:2.0}.

Distribution (software) - A bundle of software including Python and a group of Python packages to facilitate the installation of Python. Canopy is a python distribution for scientific users; it includes hundreds of packages.

Docstring - A comment enclosed in triple double quotes inserted at the very start of a program or at the start of a function to describe it. The docstring is available to documentation tools and is printed when the help() builtin function is used.

Dynamic Typing - A property of Python which allows you to set and change the type of object to which a variable is assigned to simply by assigning or reassigning it. Unlike programming languages like fortran, there is no need to define the type of a variable before assigning a value to it.


E

Element-Wise Operation - In NumPy, operation between arrays are done element by element. For example, when adding two arrays, elements of the two arrays are added individually.


F

Float - A type of numerical object with a floating point. In mathematics, it is referred to as a Real number. Example: 1.0. and 4.56.

Frame - In Pythontutor.com animations, the frame pane shows the global frame and function frames. The global frame contains all the variables defined globally within the program (ie not within a function). Function frames contain only variables defined locally within the function.

Function - A block of code executed at once when it is called. You call a function with its name followed by round brackets possible enclosing arguments.


G

Global Variable - Variables defined within the main program rather than within a function or module. In python, they are available from everywhere within a program.


I

IDLE - An Interactive Development Environment which comes as standard with a Python installation.,/p>

Immutable - An object is immutable if it can’t be modified. This is the case of Tuples, strings and numbers.

Import - Load a module or package, so that the functions and variables defined within them is made available for use in a program or interactive session.

Indentation - The fixed number of spaces preceding lines in a block of code. Indentation is used to delimit a block of code in if, while or for statements and in function definitions. It is recommended to use four spaces for one indentation. Indentation should be added together if a block of code is defined within another block, for example if you have a loop within a loop, the inner loop code will have two indentations (eight spaces). Python editors (eg IDLE) will automatically add spaces where needed.

Index - Generally an integer representing the position of an element of a sequence. It can also refer to a 'key' in the case of a mapping and can be any type of object such as a string or number.

Indexing - An action to access and potentially change an element of a sequence (eg list) or mapping (eg dictionary) corresponding to a specific index (ie it's position in a sequence). Example: mylist[3] is the forth element of mylist.

Integer - A type of numerical object without a floating point. In mathematics it is referred to as a Natural number. Example: 0, 1, 6, 123.

Interactive - Python is an interactive interpreter. This means that you can write Python commands in the interpreter and directly see the results. Just launch Python, IDLE or iPython to have access to one of the interpreters. This feature of Python is extremely useful for learning Python, improving programming skills and testing snippets of code.

Interpreted Language - A programming language which does not need to be compiled. Instead code has to be run through an interpreter.

Interpreted - Python is an interpreted language as opposed to compiled languages like C and Fortran. Python code does not have to be compiled but has to be run through a Python interpreter. You open the interpreter by launching Python, iPython, IDLE or other IDEs. (see also interactive)

Interpreter - The program used to run Python code either interactively or by running programs. The interpreter is launched by running ‘Python’ ‘iPython’ or IDLE.

IPython - A Python package which provides an powerful interactive shell (an interpreter which can also communicate with the operating system) and a browser based notebook to combined code with writing.

Iterable - A kind of data structure containing different elements, such as sequences (list, string, tuple...) and mappings (dictionary). Iterables can be used in for loops for example.


L

Library - See Package.

List Comprehension - A neat way to process elements from a sequence one by one and return the result as a list. It can often replace simple for loops in just one line. The following generates a list of the numbers from 0 to 11 as strings. result = [str(x) for x in range(12)]

List - A built-in datatype which is a sequence of values sorted in a specific way. Lists are mutable, they can be modified. It is similar to a Tuple which is an immutable sequence.

Local Variables - Variables defined within functions. They can have the same name as global variables but are treated as separate. Local variables are not available outside a function unless specifically stated.


M

Mapping - A kind of data structure containing different elements (or values), where values are associated with a key, as opposed to sequences, where values are associated with consecutive numbers. Mappings are considered unsorted although you can sort the keys. Mapping object types include dictionaries. See sequence and Dictionary.

matplotlib - A Package which provides powerful and flexible plotting based on the MATLAB syntax.

Method - A function associated with an object and called using the dot notation. For example, sort is a list method: mylist.sort().

Module - A unit of python code stored within a file or group of files which contain definitions of functions or variables. Some module are built-in (ie provided with the main Python installation), others are installed in the form of packages. You can also write your own module (not covered in this course). Examples of modules include math,which provides mathematical functions and variables, and random, which allows you to sample random values. A module is loaded into python by importing it (import math).

Mutable - An object is mutable if it can be modified in parts. Lists and Dictionaries are mutable objects.


N

Namespace - A place where variables are stored in a Python program's memory.

Nested Sequence - A nested list for example, where elements of the list are lists themselves. Nested lists are a way to store 2D data, although NumPy Arrays are much more convenient for this.

NumPy - Python package (or library) for scientific computing which allows the user to create and manipulate arrays and perform array operations.


O

Object Oriented Programming (OOP) - Type of programming that is based around objects rather than functions. Actions of functions can be tailored to the type of object it is applied to with methods. Python has that functionality, but can also be used in a basic fashion without using all the features of object oriented programming.

Object - Any data with a value, attributes and methods associated with it. A list is an object.


P

Package - A directory of python code that you install to expand the python features. For example NumPy allows you to do operations on arrays and matplotlib allows you to create plots. A package is usually a large collection of modules.

Program - Collection of statements (code) written in a file or a collection of files.


R

Return - A statement used to define the variables returned by a function when it is called, such as the value given to result in this case: result=myfunction(arg1,arg2)


S

Scalar - A number, as opposed to a Sequence, such as a list.

Script - Name given to short programs akin to programs written in scripting languages such as shell scripts.

Sequence - A kind of data structure containing different elements (or values), where values are associated with consecutive numbers. Sequence object types include list, string, tuple...

Slicing - An action which creates a new sequence from a subset of a sequence. It is done by using square brackets. For example: mylist[0:3] is a list containing the first three elements of mylist.

Statement - An individual element of code which expresses an action to be carried out. Examples of statements include: an assignment (a=3), calling a function (result=sin(pi)), a print statement (print a) or even an if statement composed of multiple lines.

Syntax - The set of rules of a computer language that define the correct combinations of symbols, expressions and commands necessary for the code to be interpreted by the computer. It is like the grammar of a programming language. If the syntax is wrong, a program will return a syntax error. For example, Python uses quotes to delimit strings and indentation (4 spaces recommended) to delimit a block of code.


T

Terminal - A window in which you enter commands to interact with the operating system (eg. bash or ksh shells or windows terminal cmd) or code to be run (eg. Python terminal).

Tuple - A built-in Python datatype which is a sequence of values sorted in a specific way. Tuples are immutable, they can't be modified. It is similar to a list which is a mutable sequence.

Type - A category of data that can be represented in Python, such as integer, string, list, dictionary...


V

Variable - A placeholder with a name for a value of any type (eg data). For example in a=3, a is a variable associated with the integer 3.