[Python-3000] Generic functions vs. OO

Paul Moore p.f.moore at gmail.com
Thu Nov 23 22:53:57 CET 2006


On 11/23/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 05:55 PM 11/23/2006 +0000, Paul Moore wrote:
> >On 11/23/06, Guido van Rossum <guido at python.org> wrote:
> > > I'm reposting this under a different subject because the other subject
> > > seems to have gone off on a tangent. The rest are Phillip's words.
> >[...]
> >
> >OK, I've read and tried to digest this. It looks good. The one thing
> >I'm still not getting, at a very concrete level, is precisely what
> >changes are required to Python to make it work.
>
> No changes as such, just additions:

Hmm, I'm not getting my question across (but that's OK, you answered
anyway). From my POV, additions are changes - if you like, I'm trying
to imagine what a diff between current Python and your proposal would
look like.

> 1. defop, addmethod/__addmethod__, maybe hasmethod/__hasmethod__
> 2. some generic function implementation that can be applied to "normal"
> Python functions

Um, isn't (1) a generic function implementation that can be applied to
Python functions?

> No changes in semantics to "def".  I'm just saying that you have to be able
> to call:
>
>      addmethod(a_function, methodfunc, a_class)

OK. So under your proposal, all Python functions are (potentially)
generic, and addmethod is how you add extra overloads? (And hasmethod
is pretty obvious, and defop AFAICT is a syntax for addmethod, is that
right?)

Did I get that right?
Paul


More information about the Python-3000 mailing list