[Python-3000] Special methods and interface-based type system

Guido van Rossum guido at python.org
Fri Nov 24 05:10:41 CET 2006


On 11/23/06, Bill Janssen <janssen at parc.com> wrote:
> > > I don't know anything by CLOS.
> >
> > I'll drop off a copy of the book on Monday.  Lord knows we have
> > zillions of extra copies floating around PARC.
>
> I'll still drop off a copy (of Common Lisp the Language, version 2),
> but there's no need to wait.  It's on the Web at
> http://www.supelec.fr/docs/cltl/clm/node260.html.  See in particular
> the "change-class" operation at
> http://www.supelec.fr/docs/cltl/clm/node305.html.
>
> I think I'm still confused (happens a lot :-) about our method
> namespace discussion.  It seems to me that Python's method namespaces
> work pretty much the same way that CLOS's do, already.  That is, you
> don't "clobber" an existing method in a base class when you define a
> new method by the same name in a derived class; you just mask it.  The
> base class' method is still there, and can still be called explicitly.

OK, maybe I  misunderstood what you wrote. I thought I heard you say
that "len" isn't just "len" -- it's the "len" defined by some
interface (and presumably implemented in a base class), and if one
defined a new "len" it wouldn't override the "len" defined by that
interface (unless one explicitly stated that it did), it would just
add a different method named "len". That would fly in the face of
Python's lookup algorithm for methods (where the first "len" you find
is the one you get). If that's not what you meant, all is probably
well.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list