Re: Differences between class and function decorator

2009-01-16 Thread Terry Reedy
mk wrote: Hello everyone, I rewrote an example someone posted here recently from: >>> def print_method_name(method): def new_meth(*args, **kwargs): print method.func_name return method(*args, **kwargs) return new_meth >>> @print_method_name def f2(): pass >>> f2

Re: Differences between class and function decorator

2009-01-16 Thread Duncan Booth
mk wrote: > Note that function decorator returned None, while class decorator > returned function. > > Why the difference in behavior? After all, print_method_name decorator > also returns a function (well it's a new function but still a function)? That would be because the function decorator