Hacker News new | past | comments | ask | show | jobs | submit login

There's 0 problem with doing:

    def outer(a):
        def inner(b):
            return a * b
        return inner
Though slightly longer, for most developers, it's still more grokkable (and related stack traces better) than:

    def outer(a):
        return lambda b: a * b
A very large part of Python's design is to emphasize readability for the majority. I still remember how long it took me to wrap my head around this "lambda thing" that I'd see pop up ever so often, even after a couple years of using Python. I eventually got fed up and took some time to really get to understand it. This shouldn't have to be the case for everyone reading random code.

Python is a primarily OOP-based language with functional aspects. And the design decisions that went into it are what makes it so popular today. It's not Haskell or Lisp or any of the other many that the majority avoid due to language complexity. Don't try to make it into one.






Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: