[Python-Dev] *Simpler* string substitutions

David Abrahams David Abrahams" <david.abrahams@rcn.com
Fri, 21 Jun 2002 13:52:10 -0400


From: "Alex Martelli" <aleax@aleax.it>

> > You yourself pleaded for PEP 246 just an hour
> > ago.  Surely that's a big honking new feature!
>
> I prefer to think of it as a framework that lets most type-casts,
type-tests,
> special purpose type-conversion methods, and the like, be avoided WITHOUT
> adding a zillion little ad-hoc features.

Such a strong endorsement from you made me go take a cursory look; I think
I'd be -1 on this in its current form. It seems like an intrusive mechanism
in that it forces the adapter or the adaptee to know how to do the job.
Given libraries A and B, can I do something to allow them to interoperate
without modifying them?

Conversely, is there a reasonably "safe" way to add adaptations to an
existing type from the outside? I'm thinking of some analogy to
specialization of traits in C++, here.

-Dave