================================================================================ Algebraic types for Python ================================================================================ An experimental implementation. Algebraic types are types, that are not structured in a tree shaped hierarchy. They combine the flexibility of duck typing with the conciseness of static typing. Algebraic types are uncommon in object oriented programming languages, but are widely used in functional programming languages. Python's type system is mainly structured as a tree-shaped hierarchy of classes, with additional multiple inheritance. However the mechanisms for abstract base classes provides a lot of flexibility, which makes the implementation of algebraic types possible. There are already some libraries that implement such ideas, for example: http://oakwinter.com/code/typecheck/ This experimental implementation focuses on: * Create real types, that can be used for ``isinstance(a, Int | Float)``. However these types can not be instantiated, like abstract base classes. (The current notation ``isinstance(a, (int, float))`` is a hack.) * Use operators to construct algebraic types, so that type expressions look elegant. Write ``Int | Float`` instead of ``union(Int, Float)`` * Not be tied to a certain type checking library.