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

> at the point of its definition

Ok, that makes sense, thanks. I guess needing syntax for this is a consequence of Python's quirky lambdas. In languages with full lambdas, you can just wrap an anonymous function at the point of definition.

   profile = login_required(function (...) ...)    -- in Lua

   (define profile (login-required (lambda (...) ...)))    ; in Scheme

   let profile = login_required(fun ... -> ...)     (* in OCaml *)   
Putting the decorator on its own line draws attention to it, though. This is probably also another instance of Python's "flat is better than nested" design choice.



Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: