[Zope-dev] improving the utility and adapter lookup APIs
Martijn Faassen
faassen at startifact.com
Thu Nov 26 14:02:37 EST 2009
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
More information about the Zope-Dev
mailing list