Python Data Hierarchy

An introduction to main Python data hierarchy

Note: This will be updated and linked to further content development

A subset of the data types that are built into Python.


We use numbers all the time. Numbers can either be integrals or non-integrals.

Arithmetic operators and arithmetic built-in functions will return numbers. Numeric objects are immutable. In other words, when a number is created, it cannot be changes or a number within it be replaced. Python numbers are the same as mathematical numbers, but subject to the limitations of numerical representation in computers.

  • Integral
    • Integers: A whole number that can be positive, negative or zero.
    • Booleans: A data type that has one of two possible values (true or false)
  • Non-integral
    • Floats: A number that has a decimal place. We use float data type when we need more precision.
    • Decimals: The decimal data type is an exact numeric defined by its precision (total number of digits) and scale (number of digits to the right of the decimal point).
    • Complexnumbers: A combination of a real and an imaginary number in the form a + bi where a and b are real numbers, and i is the “unit imaginary number” √(−1)
    • Fractions: Fraction of a number, for example 1/8, 3/4, 5/8 etc.


  • Sequences: Sequences represent finite ordered sets indexed by natural numbers.
    • Mutable: Mutable sequences can be changed after they are created.
      • Lists
    • Immutable: Immutable sequences can NOT be changed after they are created.
      • Tuples
      • Strings
  • Sets
    • Mutable
      • Sets
    • Immutable
      • Frozen sets
  • Mappings: These represent finite sets of objects indexed by arbitrary index sets.
    • Dictionaries: These represent finite sets of objects indexed by nearly arbitrary values.
  • Callables
    • User-Defined Functions
    • Generators
    • Classes
    • Instance Methods
    • Built-in Functions (for example; len(), open())
    • Built-in Methods (for example; my_list.append(x))


  • None
    • It means that there is no value (empty record). This can be used in function to explicitly return nothing. This type has a single value (singletons). This object is accessed through the built-in name None. None truth value is false.
  • Ellipsis
    • Similar to None, Ellipsis has a single value. This object is accessed through the built-in name Ellipsis. It is used to indicate the presence of the “” syntax in a slice. Ellipsis truth value is true.

You can read more on Python Data Types in Python documentation here