On 12 October 2012 10:11, Antonio Cuni <anto.c...@gmail.com> wrote: > On 10/11/2012 11:53 PM, holger krekel wrote: >> >> On a sidenote, i am not sure Python's decorator design was such >> a great idea. Maybe it should have been restricted to setting attributes >> (like C# and also java IIRC) and then a way to get those attributed >> functions on a per-class, per-module or even global basis. > > well, there are obviously things which you can't do by just setting > attributes, and moreover nothing would stop people to do the old "fn = > decor(fn)" trick. > > I think that in general the *args, **kwargs pattern works well enough. The > only two drawbacks I can see in day-to-day usage are: > > - that the name of the decorated function is different than the original one, > although nowadays we have @functools.wraps (but it's still not widely used). > > - that decorators are not composable is one wraps and the other sets an > attribute: depending on the order they are applied we might set the attribute > on the wrapper or wrapped object.
Are these being addressed by PEP 362? I must admit I haven't had time to read this yet, but if functools.wraps gets updated it was my understanding that the *args, **kwargs inspection issue should be solved and if you can set attributes on the signature object it could stay persistent in the face of composition of decorators? Regards, Floris _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev