Lesson 10 of 55
15 mins readPython Extending Interfaces
In Plain English
Interfaces can extend one or more base interfaces using the extends keyword, allowing you to compose complex shapes from reusable building blocks.
Core Rules to Remember

Composition: Inherits properties from parent interfaces without code duplication.

Multiple Inheritance: An interface can extend multiple base interfaces separated by commas.
Live Interactive Example
Hit Run Code to see it liveInheriting and Composing Interfaces
Python 3.12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Output Console
Click "Run Code" to view the rendered output.
How it works: BlogPost inherits all fields from Identifiable and Auditable while adding title and slug.
Your Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Micro Exercise
Extend Base Resource Interface
Declare interface Resource with id: string and status: "active" | "inactive".
Declare interface ComputeNode extending Resource with cpuCores: number and memoryGb: number.
Create a worker object of type ComputeNode and print its id and memoryGb.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Sandbox Output
Click "Run & Check" to test your solution.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.