Python Properties vs Methods: The Contract You Didn’t Know You Were Making
Machine-readable: Markdown · JSON API · Site index
Описание видео
🧱 Build software that lasts. Join the Software Design Mastery waiting list → https://arjan.codes/mastery.
In this video, I break down when something in Python should be a property and when it should be a method, and why that choice matters more than it looks. Using a simple example, I show how properties and methods communicate different promises about cost, safety, and behaviour.
I’ll also look at why async properties are usually a design smell, and how to keep async work explicit without breaking clean object design.
🔥 GitHub Repository: https://git.arjan.codes/2026/props.
🎓 ArjanCodes Courses: https://www.arjancodes.com/courses.
💬 Join my Discord server: https://discord.arjan.codes.
⌨️ Keyboard I’m using: https://amzn.to/49YM97v.
🔖 Chapters:
0:00 Intro
1:17 Setup: One Example for the Whole Video (Synchronous Version)
2:29 Properties vs Methods
3:48 Derived State: A Perfect Use Case for Properties
6:14 Under the Hood: Why @property Works
6:59 Read-Only vs Writable Properties
8:58 When Setters Should Not Do I/O
10:29 Abstractions: Properties Are Part of the Contract
13:13 Question: Can a Property Be Async?
16:09 Final Thoughts
#arjancodes #softwaredesign #python