Python Glossary

Python Glossary

This page is meant to be a quick reference guide to Python. If you see something that needs to be added, please let us know and we will add it to the list.

“>>>”

The default Python prompt of the interactive shell. Often seen for code examples which can be executed interactively in the interpreter.

abs

Return the absolute value of a number.

argparse

Argparse is a parser for command-line options, arguments and subcommands.

assert

Used during debugging to check for conditions that ought to apply

assignment

Giving a value to a variable.

block

Section of code which is grouped together

break Used to exit a for loop or a while loop.

class

A template for creating user-defined objects.

compiler

Translates a program written in a high-level language into a low-level language.

continue Used to skip the current block, and return to the “for” or “while” statement

conditional statement

Statement that contains an “if” or “if/else”.

debugging

The process of finding and removing programming errors.

def

Defines a function or method

dictionary

A mutable associative array (or dictionary) of key and value pairs. Can contain mixed types (keys and values). Keys must be a hashable type.

distutils

Package included in the Python Standard Library for installing, building and distributing Python code.

docstring

A docstring is a string literal that occurs as the first statement in a module, function, class, or method definition.

__future__

A pseudo-module which programmers can use to enable new language features which are not compatible with the current interpreter.

easy_install

Easy Install is a python module (easy_install) bundled with setuptools that lets you automatically download, build, install, and manage Python packages.

evaluation order

Python evaluates expressions from left to right. Notice that while evaluating an assignment, the right-hand side is evaluated before the left-hand side.

exceptions

Means of breaking out of the normal flow of control of a code block in order to handle errors or other exceptional conditions

expression

Python code that produces a value.

filter

filter(function, sequence) returns a sequence consisting of those items from the sequence for which function(item) is true

float

An immutable floating point number.

for

Iterates over an iterable object, capturing each element to a local variable for use by the attached block

function

A parameterized sequence of statements.

function call

An invocation of the function with arguments.

garbage collection

The process of freeing memory when it is not used anymore.

generators

A function which returns an iterator.

high level language

Designed to be easy for humans to read and write.

IDLE

Integrated development environment

if statement

Conditionally executes a block of code, along with else and elif (a contraction of else-if).

immutable

Cannot be changed after its created.

import

Used to import modules whose functions or variables can be used in the current program.

indentation

Python uses white-space indentation, rather than curly braces or keywords, to delimit blocks.

int

An immutable integer of unlimited magnitude.

interactive mode

When commands are read from a tty, the interpreter is said to be in interactive mode.

interpret

Execute a program by translating it one line at a time.

IPython

Interactive shell for interactive computing.

Related: iPython tutorial

iterable

An object capable of returning its members one at a time.

lambda

They are a shorthand to create anonymous functions.

list

Mutable list, can contain mixed types.

list comprehension

A compact way to process all or part of the elements in a sequence and return a list with the results.

literals

Literals are notations for constant values of some built-in types.

map

map(function, iterable, …) Apply function to every item of iterable and return a list of the results.

methods

A method is like a function, but it runs “on” an object.

module

The basic unit of code reusability in Python. A block of code imported by some other code.

object

Any data with state (attributes or value) and defined behavior (methods).

object-oriented

allows users to manipulate data structures called objects in order to build and execute programs.

pass

Needed to create an empty code block

PEP 8

A set of recommendations how to write Python code.

Python Package Index

Official repository of third-party software for Python

Pythonic

An idea or piece of code which closely follows the most common idioms of the Python language, rather than implementing code using concepts common to other languages.

reduce

reduce(function, sequence) returns a single value constructed by calling the (binary) function on the first two items of the sequence, then on the result and the next item, and so on.

set

Unordered set, contains no duplicates

setuptools

Collection of enhancements to the Python distutils that allow you to more easily build and distribute Python packages

slice

Sub parts of sequences

str

A character string: an immutable sequence of Unicode codepoints.

strings

Can include numbers, letters, and various symbols and be enclosed by either double or single quotes, although single quotes are more commonly used.

statement

A statement is part of a suite (a “block” of code).

try

Allows exceptions raised in its attached code block to be caught and handled by except clauses.

tuple

Immutable, can contain mixed types.

variables

Placeholder for texts and numbers. The equal sign (=) is used to assign values to variables.

while

Executes a block of code as long as its condition is true.

with

Encloses a code block within a context manager.

yield

Returns a value from a generator function.

Zen of Python

When you type “import this”, Python’s philosophy is printed out.

Last updated