Re: improving the utility and adapter lookup APIs
Martijn Faassen <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Message-ID | <[email protected]> |
Thomas Lotze wrote: [snip] > Then let me suggest not changing the call signature of an interface at all > but only add one or a few new methods. Firstly, this will keep backwards > compatibility even with code that adapts a tuple, and secondly, it allows > us to implement a simple and consistent API anyway. That was my original proposal, right? (I only propose adding a 'name' argument to the IFoo() lookup if it isn't there already, otherwise it's all new methods). > My favourite option under these circumstances would be something like > > IFoo.query(*args, default=None, ...) > > though possibly with a method name in a different color of bike shed, > where IFoo.query(x) is equivalent to IFoo(x) but a multiadapter lookup may > be written as IFoo.query(x, y). It could indeed be done as a single method. See Shane's post for a possible implementation. Regards, Martijn _______________________________________________ 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 )