Why Your Code Isn’t Pythonic (And How to Fix It)

Опубликовано: 07 Ноябрь 2025
на канале: ArjanCodes
161,738
6.5k

💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide.

What does it actually mean to write Pythonic code? In this video, we answer that question by taking a small, messy script and refactoring it step by step using the core principles of idiomatic Python. Along the way, you’ll learn how to think like a Pythonista: using functions instead of unnecessary classes, leveraging dataclasses, writing readable control flow, embracing tools like pathlib and logging, and applying the Zen of Python in practice.

🛍️ Check out ArjanCodes merch: https://shop.arjancodes.com.

🔥 GitHub Repository: https://git.arjan.codes/2025/pythonic.

🎓 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
0:18 What does Pythonic mean?
2:08 Before
3:13 Step 1 – Prefer Functions Over Classes
4:32 Step 2 – Use Context Managers
6:42 Step 3 – Add Type Annotations
10:46 Step 4 – Favor EAFP Over LBYL
12:06 Step 5 – Use Dataclasses for Structured Data
17:09 Step 6 – Centralize File Paths and Use
19:19 Step 7: Rely on Python's strengths
23:10 Step 8 – Add Logging Instead of Print
24:10 Step 9 – Add a Main Function
25:56 Final Thoughts

#arjancodes #softwaredesign #python


На этой странице сайта вы можете посмотреть видео онлайн Why Your Code Isn’t Pythonic (And How to Fix It) длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь ArjanCodes 07 Ноябрь 2025, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 161,738 раз и оно понравилось 6.5 тысяч зрителям. Приятного просмотра!