[Zope-dev] improving the utility and adapter lookup APIs

Tres Seaver tseaver at palladion.com
Wed Nov 25 13:27:24 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Benji York wrote:
> On Wed, Nov 25, 2009 at 10:41 AM, Martijn Faassen
> <faassen at startifact.com> 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          tseaver at palladion.com
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-----



More information about the Zope-Dev mailing list