Hi! This past week for week 6 was honestly a lot more intense than i thought it would be. We moved away from just the basic theory of iterators and started looking at how they are actually used in python to write more efficient code. Some of those things include zip, map, and filter. Though i had seen map and filter in other languages, seeing how python handles them lazily was a bit of a curveball.

The thing that really clicked in class was the usage of yield. I’ve seen this keyword in codebases before and usually just ignored it or assumed it was like a return, but learning that it actually pauses the function state and turns it into a generator was a “lightbulb” moment for me. Because I really like systems and low-level stuff, seeing how this saves memory was super cool. It tied in perfectly with Exercise #4 where we looked at how range is implemented. Seeing that range doesn’t actually store a giant list of numbers in memory but just calculates the next one on the fly makes so much sense from a performance perspective. It’s way more efficient than just clobbering the heap with a million integers.

Additionally, this week made a very cool connection for things like list comprehensions. I used to think they were just a “shorter” way to write a for loop, but they actually make the code way more readable once you get the hang of it. Combining those with zip() to iterate over multiple things at once felt very powerful. The fact that python has all these built-in tools to handle data structures without needing to write manual index counters every time makes it very powerful for quick development.

We also read Paper #6 on the Open-Closed Principle. This one felt very relevant for what we are now working on in the projects. The idea that our code should be open for extension but closed for modification is something that sounds easy on paper but is actually pretty hard to do when you’re in the middle of a project. It’s making me think more about how we structure our backend so we don’t have to rewrite everything later.

Tip of the Week: my tip is to use a better system monitor like btop or htop instead of the default task manager. If you are working in a Linux environment or even on macOS, these tools give you a really granular look at what your processes are actually doing. It’s super helpful when you’re debugging a script and want to see if you have a memory leak or if your CPU usage is spiking because of an inefficient loop. Plus, btop has a really cool UI that looks great in a terminal!