Home

Glossary

The official Python glossary is a rather technical document, so here is another glossary, aiming to summarize what is really essential for scientific programming.

BioPython

A library for Bioinformatics, that is to say, for computing with genomes and proteins. We use only two of its modules.

from Bio import ExPASy, SeqIO

bool

The boolean type.

chr()

Gives an ascii character from its integer code. For example, chr(65) gives 'A'. The inverse is ord().

float

A float has up to sixteen decimal digits (to be precise, 53 binary digits) plus up to 300 zeros to the left or right. Thus, the decimal point is "floating" and hence the name.

Arithmetic involving floats, or mixing integers and float, returns a float.

int

Python integers can be as large as you like. At some point, though, Python decides that the integers are `long' and puts an L at the end. For example:

123456789*987654321*123456789

The print command suppresses the L, so to check for an L, you need to put an integer expression on its own.

Addition, subtraction and multiplication of integers gives integers, but division requires special care.

linspace()

Not part of core Python, but very useful for scientific computing, numpy.linspace(a,b,N) gives an array of floats, going from a to b in N-1 steps.

matplotlib

The standard Python library for scientific graphics. The full user guide is huge, but plot(x,y) and scatter(x,y) will cover most of what we need.

ord()

Gives the integer code of a character. For ascii characters, ord() is simply the inverse of chr(). But ord() can be applied to any character encoding.

pylab

A library for scientific graphics, really an interface to to matplotlib.

Slicing

Extracting a region from a string, list, tuple or array. Remember that you can use negative indices to count backwards from the end.

type

Python types More details

Integers, floats and booleans are simple in the sense that they cannot be broken down further.

Zen of Python

As you might expect for a language named after a comedy show, there are a lot of Python jokes. If you type

import this

at the Python prompt, you get a bunch of aphorisms in a supposedly Zen style.