Additionally, if I was grokking Lennart correctly yesterday, __metaclass__ is going away, so the current metaclass implementation is going to need some rejiggering. What was unclear was whether a single implementation could support both <=2.5 and >=2.6. Chris On Wed, Apr 1, 2009 at 1:09 PM, Martin Aspeli <optilude+lists@gmail.com> wrote:
Hi Marius,
It's a Python 2.6/3.0 feature:
Oh... sniff... I so want that. ;)
from zope.component import adapter from zope.interface import implementer
@adapter(IFoo) @implementer(IBar) class MyClass(object):
def __init__(self, context): self.context = context ...
which translates to the obvious
class MyClass(object):
def __init__(self, context): self.context = context ...
MyClass = implementer(IBar)(MyClass) MyClass = adapter(IFoo)(MyClass)
assuming I got the application order right.
Great.
I now also wonder if adapter()/implementer() would work when called with classes rather than functions...?
I would hope so, or it'd be really confusing. :)
Martin
-- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )