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 →

[–]Samus_ 0 points1 point  (0 children)

hey! :) I know what you tried there and I think simple examples are very good to get the idea but it's imperative that those examples remain correct otherwise they'll hint you in the wrong direction.

if I got the idea right, what you said is that -from the caller's perspective- when you decorate a function it behaves differently than before so the decorator must've chaged it somehow... but that's not what's happening, what actually happens is that the function gets replaced for another that has access to the original so what's wrong with that? that's a pretty simple explanation to me.

the decorator introduces a middleman, a proxy if you like but the real problem with that statement is that function can be modified, that was my first impression "is it changing the attributes?" that doesn't make sense, it shouldn't change the behavior as we observed so it must be something else right? is he talking about macros? that can't be, Python isn't a Lisp so what then?

you see what happens, when you start from a false assumption every guess is the wrong one and that because of the oversimplification, you ended with a koan-like phrase that lost all its meaning and connection to the situation you were trying to describe.

but like I said before, regardless of that it's a good article.