Are decorators really that different from metaclasses...

Paolo Veronelli paolo.veronelli at yahoo.it
Tue Aug 24 13:05:58 EDT 2004



Paul Morrow wrote:
> ...that they warrant an entirely new syntax?  It seems that they are 
> very similar in a very significant way --- they alter the default 
> behavior of something.  IMO, it's not a stretch to say that they 
> 'parallel' metaclasses; that they are to functions/methods what 
> metaclasses are to classes.  So why don't they share a similar syntax?
> 
>    class Foo:
>       """ This is the docstring for class Foo. """
>       __metaclass__ = M
>       # body of class goes here
> 
> 
>    def baz():
>       """ This is the docstring for function baz. """
>       __features__ = synchronized, memoized
>       # body of function goes here.
> 
> 
> I personally find the above baz function aesthetically appealing.  Does 
> anyone else feel this way?  
 >
 > Paul

Obviously me,but it's possible doors are closed,too many heads try to 
solve something that I start to think show a "bug" in python 
architecture.I mean,does ruby need to throw up so much dust to add such 
a feature?Or it just allow people to "build"  language syntaxes?

	Paolino








More information about the Python-list mailing list