Re: improving the utility and adapter lookup APIs

Tres Seaver <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Benji York wrote:
> On Wed, Nov 25, 2009 at 10:41 AM, Martijn Faassen
> <[email protected]> wrote:
> [snip good stuff]
> 
>> Multiadapter:
>>
>> IFoo.multi(x, y)
> 
> I'm not sure I like the following suggestion better than the above, but
> throwing it out there anyway:
> 
> Multiadapter:
> 
> IFoo((x,y))

+1

>> Multiadapter with default:
>>
>> IFoo.multi(x, y, default=default)
> 
> Expanding the above:
> 
> IFoo((x,y), default=default)

+1 again.

>> Utility:
>>
>> IFoo.utility()
>>
>> [or possibly IFoo() instead?]
> 
> I like IFoo().

+1 (I argued for this spelling ages ago, like maybe 2002).

>> As a final thought, I don't like having to import 'implements' from
>> zope.interface either. Since we're moving to Python 2.6 which supports
>> class decorators, I'd like to see something like this become possible:
>>
>> @IFoo.implements
>> class Foo(object):
>>     pass
> 
> We already have the function decorator zope.interface.implementer, I'd
> extend that notion:
> 
> @IFoo.implementer
> class Foo(object):
>     pass

+0 here:  I don't mind the current pattern, but it might be needful to
switch to support Lennart's / MvL's work on porting to Python 3.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          [email protected]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksNdwYACgkQ+gerLs4ltQ5MOQCeNsA1pDP2o9xnJp7w/axU4xaI
2HYAniCBpRY0TxV7BBkN6ad5Dtfg49kl
=ySiv
-----END PGP SIGNATURE-----

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