Blog Post #139: Understanding Decorators, Part 3: The @ Syntax

In Post #138, we successfully built our first decorator by manually “wrapping” a function. We defined our original function, passed it to a decorator function, and then reassigned the returned wrapper back to the original function’s name. This manual process, say_whee = my_decorator(say_whee), works perfectly and clearly reveals the mechanics of how a decorator works. … Read more

Blog Post #138: Understanding Decorators, Part 2: Manually Wrapping a Function

In Post #137, we laid the groundwork for understanding decorators by confirming three key concepts: functions are objects, they can be passed as arguments, and they can be returned from other functions. Now, we’re ready to assemble these pieces to build our first manual decorator. In this post, we will walk through the step-by-step pattern … Read more

Blog Post #136: A Quick Look at itertools

In our recent discussions on generators and functional tools like map and filter, a common theme has emerged: the power of “lazy” and memory-efficient iteration. Python takes this concept even further with a specialized module in its standard library that is designed for exactly this purpose. In this post, we’ll take a quick tour of … Read more

Blog Post #130: Functional Programming 101: The map() Function

In our discussions on comprehensions and generators, we’ve touched on ideas from a programming paradigm called “functional programming.” This style emphasizes transforming data by passing it through a series of functions. Python isn’t a purely functional language, but it includes several powerful built-in functions that support this clean and expressive style of coding. In this … Read more