[Python-3000] Adaptation [was:Re: Iterators for dict keys, values, and items == annoying :)]

Paul Moore p.f.moore at gmail.com
Sun Apr 2 21:47:48 CEST 2006


On 4/2/06, Alex Martelli <aleaxit at gmail.com> wrote:
> I believe that such "magically appearing" does not depend on
> adaptation, per se, but on the mix of "convenience" approaches to
> adaptation and registration that one chooses to provide alongside it.

Apologies if I didn't explain myself well - that's what I was trying
to say, that it does happen, but it's to some extent an abuse of
adaptation. How much of an abuse is a style issue, but *I* don't like
it.

> > I don't know if that's an "unwritten rule" as such - but I can barely
> > imagine what you're describing as unacceptable (adaptation to a
> > mutable interface which adds or copies state). It just seems like a
> > stupid thing to do (or at least, not at all what adaptation is about).
> > But maybe that's what you mean by a "hidden assumption".
>
> Uh?  Consider iteration -- that's a prime example of an adaptation
> which adds "hidden state", and I don't see it as particularly
> problematic to frame as an adaptation.

Again, I'm not disagreeing with you - I see iteration as a perfectly
acceptable use of adaptation, but I don't see it as related to Nick's
"hidden assumption". That's what I was trying to say when I said I
can't imagine what Nick's getting at - in the same way that Nick is
failing to "get" your explanation of why adaptation is good, I (and
you?) am failing to see what he's getting at with his concerns. It's a
communication issue more than anything, I suspect.

> Do we have a "good practice document" about what you should or
> shouldn't do with metaclasses, or decorators, or, for that matter,
> with inheritance, operator overloading, and other powerful constructs
> and tools that have been with Python a long, long time?

Again, that was my point - I don't think there's much value in such a
document for adaptation, just as there isn't any for metaclasses, etc.

> Isn't it just wonderful, how the foes of adaptation switch horses on
> you?  First they request a simple-as-dirt, bare-bones "example
> system" -- then as soon as you provide one they come back at you with
> all sort of "cruft" to be piled on top.  Ah well, having tried to
> evangelize for adaptation for years, I've grown wearily accustomed to
> this kind of response; it sometimes looks more like such foes are
> feeling defensive, and ready to pull any trick to stop adaptation
> from getting in the language, rather than interested in the various
> technica aspect of the issue.  To be fair, this isn't all that
> different from the average reaction one always gets from python-dev
> as a whole to any proposal whatsoever.  Anyway, I hope it's clearer
> now why, each and every time, I end up giving up, and deciding that
> beating my head against a wall is more productive and fun;-).

:-)

To be fair, your simple-as-dirt strawman *does* have limitations.
That's fine, given what it's designed to do. But it's also so simple
and self-evident that it's easy to see the holes, and start trying to
fill them. Whether that's a good thing or not, I couldn't say...

Anyway, I'm getting sucked into writing more and more, and i doubt I'm
coherent by now. So I'll stop.

Paul.


More information about the Python-3000 mailing list