[Python-ideas] Object adaptation and interfaces and so forth
Talin
talin at acm.org
Mon Apr 23 05:45:29 CEST 2007
Adam Atlas wrote:
> (Not exactly an idea post, but I don't want to bother python-dev or
> python-3000 with this.)
>
> PEP 246 was rejected a year or so ago, and Guido's rejection note
> stated "Something much better is about to happen; it's too early to
> say exactly what, but it's not going to resemble the proposal in this
> PEP." Does anyone know if anything has gone on with this concept
> since then? It seems like it has a lot of really interesting
> potential, although I do see why PEP 246's specific proposal was
> rejected. It's just the "Something much better is about to happen"
> that got me curious -- is it happening yet? :)
Reminds me of that scene from 2010:
Dave Bowman: You see, something's going to happen. You must leave.
Heywood Floyd: What? What's going to happen?
Dave Bowman: Something wonderful.
Heywood Floyd: What?
Dave Bowman: I understand how you feel. You see, it's all very clear
to me now. The whole thing. It's wonderful.
The answer to your question is "yes", although it's happening in very
small stages. Specifically, Python 3000'a argument decorators and
abstract base classes are laying the groundwork for an adaption system
via generic functions.
Argument decorators make declaring of generic functions much less
cumbersome than was previously possible. And abstract base classes give
the generic functions something to work on that is more general than
merely working on concrete types - it provides a way to reason about
types in a duck-typing world.
What happens next is that there will be various 3rd party
implementations of generic function dispatch which will be based on
those two things. Phillip J. Eby has already stated that he is
interested in creating a kind of reference implementation that
incorporates most of the interesting features, however his need not be
the only one.
These generic function dispatchers, working off of both concrete and
abstract types can be used to implement object adaptation in various
ways (If anyone wants to supply some concrete examples here, please be
my guest.)
-- Talin
More information about the Python-ideas
mailing list