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

Martijn Faassen faassen at startifact.com
Thu Nov 26 04:48:22 EST 2009

Thomas Lotze wrote:
> 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?

True. It's indeed a goal, as I'd like to be able to use this sooner 
rather than later. If we break backwards compatibility then we'd have to 
go through all the IFoo() calls everywhere in all our code to see 
whether a default argument is in use.

> 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.

Sure. But if we want to retain backwards compatibility we'll have to go 
another way.



More information about the Zope-Dev mailing list