Re: implementing zope.component 4.0

Chris Withers <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
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.

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk
_______________________________________________
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 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.