The modules in this section provide a variety of mathematical functions.


The array module defines a new object type ArrayType that works almost exactly like other sequence types except that its contents are constrained to a single type. The type of an array is determined at the time of creation, using one of the following typecodes:

Type Code Description C Type Minimum Size (in bytes)
'c' 8-bit character char 1
'b' 8-bit integer signedchar 1
'B' 8-bit unsigned integer unsignedchar 1
'h' 16-bit integer short 2
'H' 16-bit unsigned integer unsignedshort 2
'i' integer int 4 or 8
'I' unsigned integer unsigned int 4 or 8
'l' long integer long 4 or 8
'L' unsigned long integer unsigned long 4 or 8
'f' single-precision float float ...

Get Python Essential Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.