[Zope-dev] implementing zope.component 4.0

Chris Withers chris at simplistix.co.uk
Fri Nov 27 09:57:26 EST 2009

Martijn Faassen wrote:
>> +0.5 --- I can live with it.  Backwards incompatibility with IFoo(one,
>> default) will be a slight inconvenience.  There were proposals I liked
>> more (IFoo.adapt(), IFoo.utility()) and proposals I liked less
>> (IFoo((one, two, we_like_parentheses, and_screw_people_adapting_tuples))).
> I'd ask people to think about this approach without considering 
> backwards compatibility issues first. 

Well, I don't think the difference between adapters and utilities is 
important, but I can understand why some people find calling the 
interface odd: it is when you think about it objectively.

We also have the backwards compatibility issue.

Combine the two, and you get me suggesting:

marker = object()
class IInterface(Interface):

    def get(self,*to_adapt,default=marker,name=None):
       "Adapt whatever is passed in to this interface"

to_adapt==() would imply a utility lookup, in the old way of thinking 
about things, but I really don't think that would be important.

I'll chuck +sys.maxint as my suggestion, obviously, but +sys.maxint-1 at 
the "from zope.component.__future__ import new_lookup" and calling 
interfaces you've described otherwise.



Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

More information about the Zope-Dev mailing list