Comment

Comment by tomjen3

Python is often claimed not to have closures but that isn't really true, what it doesn't have is anonymous functions. It does have a lambda statement, but that is limited to a single statement.

So what you end up writing is more akin to:

    def multiplier_maker(a):
      def temp(b):
        return b * a
      return temp
That is because Python allows you to declare a function anyware, even inside other functions.
parent tomjen3 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton