[Zope-dev] improving the utility and adapter lookup APIs
Thomas Lotze
tl at gocept.com
Thu Nov 26 01:39:15 EST 2009
Martijn Faassen wrote:
> Thomas Lotze wrote:
> [snip]
>> What about a simple and consistent API for all components including
>> utilities, adapters and multiadapters:
>>
>> IFoo()
>> IFoo(x)
>> IFoo(x, y)
>
> The last one won't work if we want to maintain backwards compatibility.
> The second argument is the default.
Technically, that's obvious. I guess I meant to say "How about..." then.
You didn't explicitly mention the subject of backwards compatibility in
your original message, so let's make it explicit now: Is backwards
compatibility a goal in this discussion?
If it isn't, I'm rather against an API that interprets an argument to
IFoo() as meaning different things depending on whether it's a tuple or
not. Python itself has an API that works like this (string formatting) and
is moving away from it. Requiring the default to be specified as a named
argument would also help readability IMO.
--
Thomas
More information about the Zope-Dev
mailing list