Python Standard Type Hierarchy Summary

Table of Contents

Numbers, collections, callables and singletons are python's standard type hierarchy.

In this article we present you a brief summary of type hierarchy in python programming language.

Numbers

Numbers in python are divided into integral and non-integral numbers.

  1. Integral Numbers: Plain Integers, Long Integers & Booleans
  2. Non-Integral Numbers: Floating point numbers, Complex numbers, Decimals & Fractions

Collection

Sequences, sets and maps are collection type in python.

Sequences

In python sequence can be mutable and immutable types. Mutable sequence can be changed after its creation. Immutable sequence type cannot be changed once it is created.

  1. Mutable Sequence: Lists
  2. Immutable Sequence: Tuples, Strings, Unicodes

Sets

Like sequence, sets in python can be mutable and immutable types. Mutable sets can be changed after their creation but immutable sets type cannot change once they are created.

  1. Mutable Sets: Sets
  2. Immutable Sets: Frozen Sets

Maps

In python, there is currently single mapping types: Dictionary

Callables

These are those types to which the function call operation can be made:

  1. User defined function
  2. Generators
  3. Classes
  4. Instance Methods
  5. Class Instances
  6. Built-in Functions
  7. Built-in Methods

Singleton

Singleton type has a single value. Python has following singleton types:

  1. None
  2. NotImplemented
  3. Ellipsis (...)