tubeshowcase●1,136,784 videosβ™‘ My collection 0
← Learn to Code

Learn to Code16:23

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

ArjanCodes β†—

From the creator

πŸ’‘ 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

Published 2025-05-30 Β· Watch on YouTube β†—
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code