When I want to think myself as a suitable capable Python coder, then one aspect of the language that I have never enabled I know what they are (cursorily), I read the question on the tutorial, example, stack overflow, and I understand the syntax, I can write myself, sometimes @ classmath and @staticmethod, but It never resolves the problem in an emulsifier code for me Area is never to use a decorator ever, there is no problem to me where I think, "Hmm ... it looks like a job for a decorator!"
So, I'm wondering if you can tell some examples of where you have used decorator in your programs, and hopefully I have "A-ha!" Will be the moment and meet .
I specifically use decoration for time purposes
def time_dec (func): def wrapper (* arg): t = time.clock () res = func (* arg) print func.func_name, time.clock () - t Return return cover @time_dec def myFunction ( N): ...
Comments
Post a Comment