Python Standard Type Hierarchy Summary
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.
- Integral Numbers: Plain Integers, Long Integers & Booleans
- 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.
- Mutable Sequence: Lists
- 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.
- Mutable Sets: Sets
- 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:
- User defined function
- Generators
- Classes
- Instance Methods
- Class Instances
- Built-in Functions
- Built-in Methods
Singleton
Singleton type has a single value. Python has following singleton types:
- None
- NotImplemented
- Ellipsis (...)