On 3/29/06, Phillip J. Eby <[EMAIL PROTECTED]> wrote:
At 11:35 PM 3/28/2006 -0500, Fred L. Drake, Jr. wrote:
>For Zope 3, we have decorators that work with the component architecture (I'm
>sure Phillip is familiar with these).  They're used with functions to
>indicate that the function adapts a particular kind of object, or that it
>implements or provides a particular interface.  We have different functions
>that get used for this purpose in classes that are executed within the body
>of the class.  There's some merit to being able to use a single set of
>functions in both cases, since the use cases are the same.  I'm not sure I'd
>want to change the existing pattern, though, since it's already so widespread
>within the Zope 3 codebase (including 3rd-party components).

If we're using Zope 3 as an example, I personally find that:

     class Foo:
         """Docstring here, blah blah blah
         """
         implements(IFoo)

is easier to read than:

     @implements(IFoo)
     class Foo:
         """Docstring here, blah blah blah
         """


  Yeah, but in the first case implements(IFoo) has to do dirty hacks involving sys.getframe(), so you win in once place but lose in the other one.
 

_______________________________________________
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