[PEAK] The road to PyProtocols 1.0
Phillip J. Eby
pje at telecommunity.com
Sun May 30 14:28:48 EDT 2004
At 01:59 PM 5/30/04 -0400, Bob Ippolito wrote:
>On May 30, 2004, at 1:43 AM, Phillip J. Eby wrote:
>
>>* Check if anybody's using the 'factory' argument to 'adapt()', and if
>>not, get rid of it.
>>
>>* If 'factory' isn't used anywhere, consider ditching the second
>>parameter passed to adapters. That is, instead of calling
>>'someadapter(ob,proto)', just call 'someadapter(ob)'. This would give
>>PyProtocols adapters the same calling signature as e.g. Zope adapters.
>
>I think I've used factory before, but I don't believe I've used the second
>argument to adapters. It wouldn't be a big deal if you removed factory,
>since it can be emulated by defaulting to some token and checking for the
>token after adaptation.
Yep, and the second argument to adapters can be emulated via closures or
instances. Effectively, the only reason the second argument is there is
for symmetry with the 'factory' parameter, and the 'factory' parameter
needs both so the default factory can raise a meaningful error message. If
'factory' goes away, then the last use case for the second argument goes
away too.
More information about the PEAK
mailing list