Martin Aspeli wrote:
> Gary Poster wrote:
>> I think I could get fully behind the following proposal that others have 
>> made (Shane I think was one of several?).
>> IFoo.adapt(...)
>> IFoo.utility(...)
> Thinking about it a bit, it strikes me that IFoo.adapt(context) may not 
> be right. This reads "IFoo adapt context", which doesn't make sense. 
> What I really want to hear is "context adapted to IFoo". So maybe it's
>    IFoo.adapting(context)?
>    IFoo.adapterFor(context)?
>    IFoo.adapter(context)?
> Just thinking out loud.

To me, "myobj.get(x)" reads as "myobj, please get x and give me the 
result", so "IFoo.adapt(y)" reads as "IFoo, please adapt y and give me 
the result".  That statement makes perfect sense to me.

> Thinking out loud further, I think I may actually prefer IFoo.instance() 
> instead of .utility(), but maybe that debate is already passed. 
> .utility() is OK too.

To me, generic names like "instance" and "singleton" suggest we're 
trying to solve some grand problem that would make our brains hurt.  I 
find it more satisfying to solve a more specific problem.

I am participating in this thread because I believe the current 
zope.component API is unnecessarily verbose, hindering readability and 
adoption by Python projects that would benefit.  I think adding adapt() 
and utility() to zope.interface.Interface might improve the situation. 
We could instead add adapt() and utility() functions to the 
zope.component package, but I haven't seen any function signature that 
would turn out as simple as "IFoo.adapt(x)".


Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to