
Hi! This past week we covered quite a bit of content. Some of those things include iterators. Though we had used iterators in Java previously, I had never considered their usage in Python. Seeing that there were different types of iterators and seeing how they could differently be indexed or compared did confuse me quite a bit.
That finally clicked in class, though, when we learned how things like the for-in loop were actually implemented and how iterators made things more simple for going over untraditional data structures.
Additionally, this week made a very cool connection for things like “reduce”. I had heard their usage before and understood they did something on Arrays or other datatypes, but only now did I find out what it actually did or how it worked. The fact that python is able to take in different objects as a self makes it very powerful to be able to use functions as if they were static. It’s also very cool that Python ships with preoptimized versions of the operators so we don’t need to reinvent the wheel every time we do something.
The programming challenge this week was pretty fun! I liked writing the reduce function and thought it was pretty cool seeing how certain iterators forced us to think outside of the box. I thought it was cool seeing that we could basically implement a prefix sum in order to make sure that everything worked.
For my tip of the week, I want to mention committing code often. Sometimes, it makes sense to just commit your code if you have a very simple change. Though you might think it clutters up your commit history, it really is useful and serves 2 purposes. One: it helps you get more green on your GitHub commit history! But more seriously, it also enables you to rollback code if you need to and ensures you have a backup. Also, if you make sure to create new branches for your commits, you can squash your commits into a single one when merging. That means you get the benefits of more commits without the drawbacks!