Stop Using map() and filter() Like This in Python

Published: 30 May 2025
on channel: ArjanCodes
97,898
2.3k

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

Think map() and filter() are always better than for loops? Not so fast. In this video, I’ll walk you through four situations where functional code actually makes things worse—and explain why the classic for loop still deserves a place in your toolbox.

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

🎓 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:26 The Classic For Loop
1:15 Using filter() and map()
2:33 List Comprehensions
3:22 Performance Comparison
4:32 When Not to Use map() or filter()
4:51 Case 1: Complex Logic
7:54 Case 2: Exception Handling
10:33 Case 3: Side Effects (e.g., Writing to File or Logging)
12:36 Case 4: Early Exit with break or continue
13:56 TL;DR
15:44 Final Thoughts

#arjancodes #softwaredesign #python


On this page of the site you can watch the video online Stop Using map() and filter() Like This in Python with a duration of hours minute second in good quality, which was uploaded by the user ArjanCodes 30 May 2025, share the link with friends and acquaintances, this video has already been watched 97,898 times on youtube and it was liked by 2.3 thousand viewers. Enjoy your viewing!