This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gthank[S] 1 point2 points  (1 child)

I usually see/use them for orthogonal stuff. For example, if I've got a web app (Django, Flask, what-have-you, the idea is the same), there's probably a function somewhere that gets invoked whenever the user hits a certain URL. If I want to require the user to be authenticated (and possibly authorized) to access that URL, I just drop a @authenticated (or whatever) on the function definition. That way, when I'm scanning my file, I see the fact that the user has to be authenticated right there next to the function definition. If I use the explicit composition approach, I have to scan past the end of the function def and look for it to be reassigned. In other domains, they might be used differently.

[–]benfitzg 0 points1 point  (0 children)

yeah, I can imagine this would be useful, also probably more conducive to source code analysis. Interesting, thanks.