Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I first came across decorators in TurboGears where they are used extensively for exposing methods, pagination etc (similar to pylons and Django).

They are very useful and insanely easy to use in python.



Not really familiar with TurboGears, but it's always awesome to see an app leveraging a language's natural power and flexibility.

I concur about decorators being "insanely easy to use"--taking the memoization example I presented in the article; it's far, far simpler to tack on "@memoize" than to incorporate it into the flow of a function and risk losing clarity. I am sure TurboGears (and Django/Pylons) authors love that you can decorate something with @login_required (or equivalent) and have that method exposed to authentication.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: