7 Weird Things You Can Do with Python Dataclasses
š§āš» Join the Software Design Mastery waitlist here: https://www.arjancodes.com/mastery. In this video, I show you 7 powerful and lesser-known things you can do with dataclasses in Python. From automatic class registration and lightweight validation systems to cached derived values, context managers, CLI generation, and the often misunderstood `InitVar`. š„ GitHub Repository: https://git.arjan.codes/2026/dctricks. š 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 Introduction 1:23 1. Dataclass as a Singleton-like Factory 7:12 2. Dataclasses with Automatic Registration 12:17 3. Dataclass Validation System (Mini-Pydantic) 15:59 4. Generating SQL Schemas from Dataclasses (Simplified) 18:39 5. Dataclasses With Cached Properties 21:31 6. Dataclass as a Self-Building CLI Argument Parser 23:59 7. Dataclass as a Context Manager 25:43 Bonus: InitVar Constructor-Only Fiel
Watch on ArjanCodes
Opens in a new tab




