[Zope-dev] improving the utility and adapter lookup APIs

Benji York benji at zope.com
Wed Nov 25 11:01:40 EST 2009


On Wed, Nov 25, 2009 at 10:41 AM, Martijn Faassen
<faassen at startifact.com> wrote:
[snip good stuff]

> Multiadapter:
>
> IFoo.multi(x, y)

I'm not sure I like the following suggestion better than the above, but
throwing it out there anyway:

Multiadapter:

IFoo((x,y))

> Multiadapter with default:
>
> IFoo.multi(x, y, default=default)

Expanding the above:

IFoo((x,y), default=default)

> Utility:
>
> IFoo.utility()
>
> [or possibly IFoo() instead?]

I like IFoo().

> As a final thought, I don't like having to import 'implements' from
> zope.interface either. Since we're moving to Python 2.6 which supports
> class decorators, I'd like to see something like this become possible:
>
> @IFoo.implements
> class Foo(object):
>     pass

We already have the function decorator zope.interface.implementer, I'd
extend that notion:

@IFoo.implementer
class Foo(object):
    pass

> If we do well we might all have this for Christmas. :)

/me pens a letter to Zanta Claus.
-- 
Benji York


More information about the Zope-Dev mailing list