Re: [Python-Dev] On decorators implementation

2005-08-22 Thread Greg Ewing
Paolino wrote: > Maybe it's possible to let the decorator know the method class even if > the class is still undefined.(Just like recursive functions?) No, it's not possible. The situation is not the same. With recursive functions, both functions are defined before either of them is called. But

Re: [Python-Dev] On decorators implementation

2005-08-22 Thread Guido van Rossum
> Maybe it's possible to let the decorator know the method class even if > the class is still undefined.(Just like recursive functions?) > This would allow decorators to call super with the right class also. > @callSuper decoration is something I really miss. You're thinking about it all wrong. R

Re: [Python-Dev] On decorators implementation

2005-08-22 Thread Paolino
Paolino wrote: > I noticed (via using them) that decorations are applied to methods > before they become methods. > > This choice flattens down the implementation to no differentiating > methods from functions. > > > > 1) > I have to apply euristics on the wrapped function type when I use the

Re: [Python-Dev] On decorators implementation

2005-08-21 Thread Martin v. Löwis
Paolino wrote: > I imagine that a method implementation of them inside the type metaclass > could be better specified by people. What you ask for is unimplementable. Method objects are created only when the method is accessed, not (even) when the class is created. Watch this: >>> class X: ... d

[Python-Dev] On decorators implementation

2005-08-21 Thread Paolino
I noticed (via using them) that decorations are applied to methods before they become methods. This choice flattens down the implementation to no differentiating methods from functions. 1) I have to apply euristics on the wrapped function type when I use the function as an index key.