Re: improving the utility and adapter lookup APIs

Leonardo Rochael Almeida <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
On Thu, Nov 26, 2009 at 14:34, Benji York <[email protected]> wrote:
> On Wed, Nov 25, 2009 at 11:17 AM, Matthew Wilkes
> <[email protected]> wrote:
>>
>> On 2009-11-25, at 1601, Benji York wrote:
>>
>>> I'm not sure I like the following suggestion better than the above, but
>>> throwing it out there anyway:
>>>
>>> Multiadapter:
>>>
>>> IFoo((x,y))
>>
>> I know it's probably a spurious use case, but what if I want to adapt a
>> tuple?
>
> There could be an optional keyword argument to be explicit.
>
> This would be a single-adapter lookup:
>
> IFoo(from=my_tuple)

You probably already realized it by now, but this is a syntax error
(remember: "from module import name").

>
> While this would be a multi-adapter lookup:
>
> IFoo(my_tuple)

To take my stab at this bikeshed painting, and since it doesn't seem
likely we'd want to break backward compatibility, I think I'd prefer
the other way around:

IFoo(multi=my_tuple)

and leave the first parameter for single adaptation, although what I'd
really prefer is multi-adaptation on multiple positional parameter.

Cheers, Leo
_______________________________________________
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.