[Python-Dev] PEP 246, redux
Alex Martelli
aleax at aleax.it
Wed Jan 12 15:06:49 CET 2005
On 2005 Jan 12, at 14:44, Paul Moore wrote:
> On Wed, 12 Jan 2005 00:33:22 +0100, Alex Martelli <aleax at aleax.it>
> wrote:
>> But adaptation is not transmission! It's PERFECTLY acceptable for an
>> adapter to facade: to show LESS information in the adapted object than
>> was in the original. It's PERFECTLY acceptable for an adapter to say
>> "this piece information is not known" when it's adapting an object for
>> which that information, indeed, is not known. It's only CONJOINING
>> the
>> two perfectly acceptable adapters, as transitivity by adapter chain
>> would do automatically, that you end up with a situation that is
>> pragmatically undesirable: asserting that some piece of information is
>> not known, when the information IS indeed available -- just not by the
>> route automatically taken by the transitivity-system.
>
> [Risking putting my head above the parapet here :-)]
>
> If you have adaptations A->B, B->C, and A->C, I would assume that the
> system would automatically use the direct A->C route rather than
> A->B->C. I understand that this is what PyProtocols does.
Yes, it is.
> Are you mistakenly thinking that shortest-possible-route semantics
> aren't used? Maybe the PEP should explicitly require such semantics.
No, I'm not. I'm saying that if, by mistake, the programmer has NOT
registered the A->C adapter (which would be easily coded and work
perfectly), then thanks to transitivity, instead of a clear and simple
error message leading to immediate diagnosis of the error, they'll get
a subtle unnecessary degradation of information and resulting reduction
in information quality.
PyProtocols' author claims this can't happen because if adapters A->B
and B->C are registered then each adapter is always invariably claiming
to be lossless and perfect. However, inconsistently with that stance,
I believe that PyProtocols does give an error message if it finds two
adaptation paths of equal minimum length, A->B->C or A->Z->C -- if it
is truly believed that each adaptation step is lossless and perfect,
it's inconsistent to consider the existence of two equal-length paths
an error... either path should be perfect, so just picking either one
of them should be a perfectly correct strategy.
> If I'm missing the point here, I apologise. But I get the feeling that
> something's getting lost in the discussions.
The discussions on this subject always and invariably get extremely
long (and often somewhat heated, too), so it's quite possible that a
lot is getting lost along the way, particularly to any other reader
besides the two duelists. Thus, thanks for focusing on one point that
might well be missed by other readers (though not by either PJE or
me;-) and giving me a chance to clarify it!
Alex
More information about the Python-Dev
mailing list