[Python-3000] Special methods and interface-based type system
Bill Janssen
janssen at parc.com
Wed Nov 22 23:51:37 CET 2006
> Bill Janssen wrote:
>
> > This seems kind of a weak rationale to me, but OK.
>
> yeah, namespaces are such a useless thing. let's put everything in one
> big flat namespace, so we don't have to wonder where things are.
>
> </F>
Pardon me? That's what we've got now, isn't it? That's why we have
to do that ugly and hard-to-explain name mangling for "special"
methods.
Here's why I think it's weak:
1) Mainly, all methods are special to someone. Having only one
hard-to-differentiate syntactic mechanism to identify them really
doesn't work very well.
2) But also, if Python was built with interfaces, "special" methods
would each be in their own namespace. That is, a user wouldn't have
to worry about accidentally overriding a method; they'd have to
explicitly override the "len" method inherited from the "container"
interface; just defining a method called "len" in their subclass
wouldn't do it. CLOS is rather elegant in this respect.
Bill
More information about the Python-3000
mailing list