Skip to content

Comment on Method Combinators in CoffeeScriptparent

Comments

Just FYI, he's not talking about the decorator being anonymous, he's talking about the function the decorator is wrapping being anonymous. What he means is that, since python lambda's are one-line, you can't do something like:

    ifAuthorized("admin", lambda x:
      // more code here

> What he means is that, since python lambda's are one-line

Technically, Python's lambdas are one-expression not one-line.

Within that constraint you can create as complex lambdas as you want (you'll probably need to create helpers for things like loops, and you may be hindered by Python's limits on recursion, but FWIW Scheme's or Haskell's functions have the exact same limitation, the primary difference being they're nowhere near as statement-heavy as Python).

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.