Re: Decorator metaclass

2008-05-24 Thread Gabriel Genellina
En Fri, 23 May 2008 16:25:19 -0300, Thomas Karolski <[EMAIL PROTECTED]> escribió: > Turns out the first msg I sent did not reach the list, so I'll just post > what I've achieved by now: [snip a couple of long metaclasses] > Now the reason why I'm using decorators, is because I want to be ably t

Re: Decorator metaclass

2008-05-23 Thread Thomas Karolski
Turns out the first msg I sent did not reach the list, so I'll just post what I've achieved by now: -- class DecoratorDummy(object): pass class InheritedDecoratorType(type): def __new__(cls, name, bases, dct): # return if its a clas

Re: Decorator metaclass

2008-05-23 Thread Carl Banks
On May 23, 11:42 am, Thomas Karolski <[EMAIL PROTECTED]> wrote: > > You will note that Decorator does not define __init__. In fact, > > object.__init__ will be called, which does nothing. If you think that > > all classes with DecoratorType as their metaclass will be a direct > > subclass of Dec

Re: Decorator metaclass

2008-05-23 Thread Thomas Karolski
Thanks for pointing out all those mistakes. I think I'm already starting to grasp all of the python magic going on in there. Parenthetical: I don't normally recommend this style, since it obscures the fact that you're using a custom metaclass to the user. That is something the user probably wou

Re: Decorator metaclass

2008-05-23 Thread Carl Banks
On May 22, 10:28 pm, [EMAIL PROTECTED] wrote: > Hi, > I would like to create a Decorator metaclass, which automatically > turns a class which inherits from the "Decorator" type into a > decorator. > A decorator in this case, is simply a class which has all of its > decorator implementation inside a

Re: Decorator metaclass

2008-05-22 Thread Maric Michaud
Le Friday 23 May 2008 04:28:22 [EMAIL PROTECTED], vous avez écrit : > Hi, > I would like to create a Decorator metaclass, which automatically > turns a class which inherits from the "Decorator" type into a > decorator. > A decorator in this case, is simply a class which has all of its > decorator