The official Python glossary is a rather technical document, so here is another glossary, aiming to summarize what is really essential for scientific programming.
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
The boolean type.
Gives an ascii character from its integer code. For
example, chr(65)
gives 'A'
. The inverse
is ord()
.
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.
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.
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.
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.
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.
A library for scientific graphics, really an interface to
to matplotlib
.
Extracting a region from a string, list, tuple or array. Remember that you can use negative indices to count backwards from the end.
Python types More details
Integers, floats and booleans are simple in the sense that they cannot be broken down further.
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.