Fred L. Drake, Jr. wrote:
>  > It's too bad this syntax is ambiguous:
>  >
>  >      class Foo:
>  >          """Docstring here, blah blah blah
>  >          """
>  >          @implements(IFoo)
>  >
>  > As this achieves a desirable highlighting of the specialness, without
>  > forcing the decorator outside the class.  Oh well.
> 
> Agreed, but... guess we can't have everything.  On the other hand, something 
> like:
> 
>     class Foo:
>         """Documentation is good."""
> 
>         @class implements(IFoo)
> 
> is not ambiguous.  Hmm.  It even says what it means.  :-)

This is quite reminiscent of Ruby to me, where:

   class Foo:
       implements(IFoo)

basically means:

   class Foo:
       pass
   Foo.implements(IFoo)

For a variety of reasons that doesn't work for Python, but what you 
propose accomplishes the same basic thing.

I'm coming in a little late on all this, but I find moving the decorator 
inside the class statement to be a substantial improvement, even if it 
is also a trivial improvement ;)  Anytime I've done thought experiments 
about using class decorators, the results is very hard to read.  That 
classes are inherently declarative and open, while functions are 
imperative and closed, makes the constructs very different.


-- 
Ian Bicking  /  [EMAIL PROTECTED]  /  http://blog.ianbicking.org
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to