Think in Expressions

There is a line of code in the orders module that has been bothering Priya for three weeks. It does in one line what she would write in five. A list, a condition, a transformation, all compressed into a single expression that her tech lead wrote and everyone else on the team apparently understands. She has been copying the pattern into her own code, changing the variable names, hoping nobody asks her to explain it in a pull request review. She knows loops. She is good at loops. She can write a for-loop that filters orders by status, calculates totals, builds a new list of results. It works. It passes tests. But every time she submits a PR, someone rewrites her five lines into one and calls it a comprehension. She nods, approves the change, and privately wonders whether she is the only developer who finds this unreadable. She is not. Comprehensions look like someone compressed a paragraph into a text message, and generators look like comprehensions that forgot to finish loading. But here is what nobody told her: these are not clever shortcuts. They are a different way of thinking about data. A loop says "do this, one step at a time." A comprehension says "here is what I want." And a generator says "here is what I want, but only give me one piece at a time, because there might be a million of them." That line in the orders module is about to make sense.