Re: improving the utility and adapter lookup APIs

Benji York <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
On Wed, Nov 25, 2009 at 10:41 AM, Martijn Faassen
<[email protected]> 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
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.