Lesson 25 of 55
10 mins readPython Type Hierarchy & Abstract Types
In Plain English
Julia types form a directed tree hierarchy rooted at Any. Abstract types define categories for multiple dispatch without specifying concrete field layouts.
Deep Dive: How It Works
Subtype Operator (<:): Int64 <: Signed <: Integer <: Real <: Number <: Any evaluates to true.
Abstract Types: Defined with abstract type Shape end. Abstract types cannot be instantiated directly; they exist solely to group types for multiple dispatch.
Concrete Types: Leaves of the type tree that can be instantiated (e.g. Int64, Float64, String).
Core Rules to Remember

Subtype Operator <:: Test type hierarchy relationships: Float64 <: Real evaluates to true.

Abstract Type Declarations: Declare abstract type Vehicle end to enable polymorphic dispatch over all vehicles.
Live Interactive Example
Hit Run Code to see it liveAbstract Type Hierarchy and Subtyping
Python 3.12
1
2
3
4
5
6
7
8
9
10
11
Output Console
Click "Run Code" to view the rendered output.
How it works: Stock is a subtype of Security, which is a subtype of Asset.
Your Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Micro Exercise
Verify Number Subtype Relationship
Check if `Float64 <: Number` and assign to `is_num`.
Print `"Is Float64 a Number: "` followed by `is_num`.
1
2
Sandbox Output
Click "Run & Check" to test your solution.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.